Home | History | Annotate | Download | only in X86
      1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
      2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s
      3 
      4 define <8 x i32> @cmp00(<8 x float> %a, <8 x float> %b) nounwind {
      5 ; CHECK-LABEL: cmp00:
      6 ; CHECK:       # %bb.0:
      7 ; CHECK-NEXT:    vcmpltps %ymm1, %ymm0, %ymm0
      8 ; CHECK-NEXT:    retq
      9   %bincmp = fcmp olt <8 x float> %a, %b
     10   %s = sext <8 x i1> %bincmp to <8 x i32>
     11   ret <8 x i32> %s
     12 }
     13 
     14 define <4 x i64> @cmp01(<4 x double> %a, <4 x double> %b) nounwind {
     15 ; CHECK-LABEL: cmp01:
     16 ; CHECK:       # %bb.0:
     17 ; CHECK-NEXT:    vcmpltpd %ymm1, %ymm0, %ymm0
     18 ; CHECK-NEXT:    retq
     19   %bincmp = fcmp olt <4 x double> %a, %b
     20   %s = sext <4 x i1> %bincmp to <4 x i64>
     21   ret <4 x i64> %s
     22 }
     23 
     24 declare void @scale() nounwind
     25 
     26 define void @render() nounwind {
     27 ; CHECK-LABEL: render:
     28 ; CHECK:       # %bb.0: # %entry
     29 ; CHECK-NEXT:    pushq %rbp
     30 ; CHECK-NEXT:    pushq %rbx
     31 ; CHECK-NEXT:    pushq %rax
     32 ; CHECK-NEXT:    xorl %eax, %eax
     33 ; CHECK-NEXT:    testb %al, %al
     34 ; CHECK-NEXT:    jne .LBB2_6
     35 ; CHECK-NEXT:  # %bb.1: # %for.cond5.preheader
     36 ; CHECK-NEXT:    xorl %ebx, %ebx
     37 ; CHECK-NEXT:    movb $1, %bpl
     38 ; CHECK-NEXT:    jmp .LBB2_2
     39 ; CHECK-NEXT:    .p2align 4, 0x90
     40 ; CHECK-NEXT:  .LBB2_5: # %if.then
     41 ; CHECK-NEXT:    # in Loop: Header=BB2_2 Depth=1
     42 ; CHECK-NEXT:    callq scale
     43 ; CHECK-NEXT:  .LBB2_2: # %for.cond5
     44 ; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
     45 ; CHECK-NEXT:    testb %bl, %bl
     46 ; CHECK-NEXT:    jne .LBB2_2
     47 ; CHECK-NEXT:  # %bb.3: # %for.cond5
     48 ; CHECK-NEXT:    # in Loop: Header=BB2_2 Depth=1
     49 ; CHECK-NEXT:    testb %bpl, %bpl
     50 ; CHECK-NEXT:    jne .LBB2_2
     51 ; CHECK-NEXT:  # %bb.4: # %for.body33
     52 ; CHECK-NEXT:    # in Loop: Header=BB2_2 Depth=1
     53 ; CHECK-NEXT:    vucomisd {{\.LCPI.*}}, %xmm0
     54 ; CHECK-NEXT:    jne .LBB2_5
     55 ; CHECK-NEXT:    jp .LBB2_5
     56 ; CHECK-NEXT:    jmp .LBB2_2
     57 ; CHECK-NEXT:  .LBB2_6: # %for.end52
     58 ; CHECK-NEXT:    addq $8, %rsp
     59 ; CHECK-NEXT:    popq %rbx
     60 ; CHECK-NEXT:    popq %rbp
     61 ; CHECK-NEXT:    retq
     62 entry:
     63   br i1 undef, label %for.cond5, label %for.end52
     64 
     65 for.cond5:
     66   %or.cond = and i1 undef, false
     67   br i1 %or.cond, label %for.body33, label %for.cond5
     68 
     69 for.cond30:
     70   br i1 false, label %for.body33, label %for.cond5
     71 
     72 for.body33:
     73   %tobool = fcmp une double undef, 0.000000e+00
     74   br i1 %tobool, label %if.then, label %for.cond30
     75 
     76 if.then:
     77   call void @scale()
     78   br label %for.cond30
     79 
     80 for.end52:
     81   ret void
     82 }
     83 
     84 define <8 x i32> @int256_cmp(<8 x i32> %i, <8 x i32> %j) nounwind {
     85 ; CHECK-LABEL: int256_cmp:
     86 ; CHECK:       # %bb.0:
     87 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm2
     88 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm3
     89 ; CHECK-NEXT:    vpcmpgtd %xmm2, %xmm3, %xmm2
     90 ; CHECK-NEXT:    vpcmpgtd %xmm0, %xmm1, %xmm0
     91 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
     92 ; CHECK-NEXT:    retq
     93   %bincmp = icmp slt <8 x i32> %i, %j
     94   %x = sext <8 x i1> %bincmp to <8 x i32>
     95   ret <8 x i32> %x
     96 }
     97 
     98 define <4 x i64> @v4i64_cmp(<4 x i64> %i, <4 x i64> %j) nounwind {
     99 ; CHECK-LABEL: v4i64_cmp:
    100 ; CHECK:       # %bb.0:
    101 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm2
    102 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm3
    103 ; CHECK-NEXT:    vpcmpgtq %xmm2, %xmm3, %xmm2
    104 ; CHECK-NEXT:    vpcmpgtq %xmm0, %xmm1, %xmm0
    105 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
    106 ; CHECK-NEXT:    retq
    107   %bincmp = icmp slt <4 x i64> %i, %j
    108   %x = sext <4 x i1> %bincmp to <4 x i64>
    109   ret <4 x i64> %x
    110 }
    111 
    112 define <16 x i16> @v16i16_cmp(<16 x i16> %i, <16 x i16> %j) nounwind {
    113 ; CHECK-LABEL: v16i16_cmp:
    114 ; CHECK:       # %bb.0:
    115 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm2
    116 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm3
    117 ; CHECK-NEXT:    vpcmpgtw %xmm2, %xmm3, %xmm2
    118 ; CHECK-NEXT:    vpcmpgtw %xmm0, %xmm1, %xmm0
    119 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
    120 ; CHECK-NEXT:    retq
    121   %bincmp = icmp slt <16 x i16> %i, %j
    122   %x = sext <16 x i1> %bincmp to <16 x i16>
    123   ret <16 x i16> %x
    124 }
    125 
    126 define <32 x i8> @v32i8_cmp(<32 x i8> %i, <32 x i8> %j) nounwind {
    127 ; CHECK-LABEL: v32i8_cmp:
    128 ; CHECK:       # %bb.0:
    129 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm2
    130 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm3
    131 ; CHECK-NEXT:    vpcmpgtb %xmm2, %xmm3, %xmm2
    132 ; CHECK-NEXT:    vpcmpgtb %xmm0, %xmm1, %xmm0
    133 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
    134 ; CHECK-NEXT:    retq
    135   %bincmp = icmp slt <32 x i8> %i, %j
    136   %x = sext <32 x i1> %bincmp to <32 x i8>
    137   ret <32 x i8> %x
    138 }
    139 
    140 define <8 x i32> @int256_cmpeq(<8 x i32> %i, <8 x i32> %j) nounwind {
    141 ; CHECK-LABEL: int256_cmpeq:
    142 ; CHECK:       # %bb.0:
    143 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm2
    144 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm3
    145 ; CHECK-NEXT:    vpcmpeqd %xmm2, %xmm3, %xmm2
    146 ; CHECK-NEXT:    vpcmpeqd %xmm1, %xmm0, %xmm0
    147 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
    148 ; CHECK-NEXT:    retq
    149   %bincmp = icmp eq <8 x i32> %i, %j
    150   %x = sext <8 x i1> %bincmp to <8 x i32>
    151   ret <8 x i32> %x
    152 }
    153 
    154 define <4 x i64> @v4i64_cmpeq(<4 x i64> %i, <4 x i64> %j) nounwind {
    155 ; CHECK-LABEL: v4i64_cmpeq:
    156 ; CHECK:       # %bb.0:
    157 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm2
    158 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm3
    159 ; CHECK-NEXT:    vpcmpeqq %xmm2, %xmm3, %xmm2
    160 ; CHECK-NEXT:    vpcmpeqq %xmm1, %xmm0, %xmm0
    161 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
    162 ; CHECK-NEXT:    retq
    163   %bincmp = icmp eq <4 x i64> %i, %j
    164   %x = sext <4 x i1> %bincmp to <4 x i64>
    165   ret <4 x i64> %x
    166 }
    167 
    168 define <16 x i16> @v16i16_cmpeq(<16 x i16> %i, <16 x i16> %j) nounwind {
    169 ; CHECK-LABEL: v16i16_cmpeq:
    170 ; CHECK:       # %bb.0:
    171 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm2
    172 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm3
    173 ; CHECK-NEXT:    vpcmpeqw %xmm2, %xmm3, %xmm2
    174 ; CHECK-NEXT:    vpcmpeqw %xmm1, %xmm0, %xmm0
    175 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
    176 ; CHECK-NEXT:    retq
    177   %bincmp = icmp eq <16 x i16> %i, %j
    178   %x = sext <16 x i1> %bincmp to <16 x i16>
    179   ret <16 x i16> %x
    180 }
    181 
    182 define <32 x i8> @v32i8_cmpeq(<32 x i8> %i, <32 x i8> %j) nounwind {
    183 ; CHECK-LABEL: v32i8_cmpeq:
    184 ; CHECK:       # %bb.0:
    185 ; CHECK-NEXT:    vextractf128 $1, %ymm1, %xmm2
    186 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm3
    187 ; CHECK-NEXT:    vpcmpeqb %xmm2, %xmm3, %xmm2
    188 ; CHECK-NEXT:    vpcmpeqb %xmm1, %xmm0, %xmm0
    189 ; CHECK-NEXT:    vinsertf128 $1, %xmm2, %ymm0, %ymm0
    190 ; CHECK-NEXT:    retq
    191   %bincmp = icmp eq <32 x i8> %i, %j
    192   %x = sext <32 x i1> %bincmp to <32 x i8>
    193   ret <32 x i8> %x
    194 }
    195 
    196 ;; Scalar comparison
    197 
    198 define i32 @scalarcmpA() uwtable ssp {
    199 ; CHECK-LABEL: scalarcmpA:
    200 ; CHECK:       # %bb.0:
    201 ; CHECK-NEXT:    vxorpd %xmm0, %xmm0, %xmm0
    202 ; CHECK-NEXT:    vcmpeqsd %xmm0, %xmm0, %xmm0
    203 ; CHECK-NEXT:    vmovq %xmm0, %rax
    204 ; CHECK-NEXT:    andl $1, %eax
    205 ; CHECK-NEXT:    # kill: def $eax killed $eax killed $rax
    206 ; CHECK-NEXT:    retq
    207   %cmp29 = fcmp oeq double undef, 0.000000e+00
    208   %res = zext i1 %cmp29 to i32
    209   ret i32 %res
    210 }
    211 
    212 define i32 @scalarcmpB() uwtable ssp {
    213 ; CHECK-LABEL: scalarcmpB:
    214 ; CHECK:       # %bb.0:
    215 ; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
    216 ; CHECK-NEXT:    vcmpeqss %xmm0, %xmm0, %xmm0
    217 ; CHECK-NEXT:    vmovd %xmm0, %eax
    218 ; CHECK-NEXT:    andl $1, %eax
    219 ; CHECK-NEXT:    retq
    220   %cmp29 = fcmp oeq float undef, 0.000000e+00
    221   %res = zext i1 %cmp29 to i32
    222   ret i32 %res
    223 }
    224 
    225