Skip to content

_mm_adds_epu8 doesn't generate the right instruction. #2154

Description

@ruriww

https://godbolt.org/z/KTTPcKP58

#[target_feature(enable = "sse2")]
pub fn simd_gte2(x: __m128i) -> i32 {
  let bc = _mm_set1_epi8(0x7e);
  let y = _mm_adds_epu8(x, bc);
  
   _mm_movemask_epi8(y)
}
.LCPI0_0:
        .zero   16,2
example::simd_gte2:
        movdqa  xmm0, xmmword ptr [rdi]
        movdqa  xmm1, xmmword ptr [rip + .LCPI0_0]
        pmaxub  xmm1, xmm0 ; 1
        pcmpeqb xmm1, xmm0 ; 2: these two instructions can be simplified to paddusb
        pmovmskb        eax, xmm1
        ret

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions