Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -mtriple=i386-unknown-unknown -mcpu=core-avx2 < %s | FileCheck --check-prefix=BMI2 %s
      2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=core-avx2 < %s | FileCheck --check-prefix=BMI264 %s
      3 
      4 define i32 @shl32(i32 %x, i32 %shamt) nounwind uwtable readnone {
      5 entry:
      6   %shl = shl i32 %x, %shamt
      7 ; BMI2: shl32
      8 ; BMI2: shlxl
      9 ; BMI2: ret
     10 ; BMI264: shl32
     11 ; BMI264: shlxl
     12 ; BMI264: ret
     13   ret i32 %shl
     14 }
     15 
     16 define i32 @shl32i(i32 %x) nounwind uwtable readnone {
     17 entry:
     18   %shl = shl i32 %x, 5
     19 ; BMI2: shl32i
     20 ; BMI2-NOT: shlxl
     21 ; BMI2: ret
     22 ; BMI264: shl32i
     23 ; BMI264-NOT: shlxl
     24 ; BMI264: ret
     25   ret i32 %shl
     26 }
     27 
     28 define i32 @shl32p(i32* %p, i32 %shamt) nounwind uwtable readnone {
     29 entry:
     30   %x = load i32* %p
     31   %shl = shl i32 %x, %shamt
     32 ; BMI2: shl32p
     33 ; BMI2: shlxl %{{.+}}, ({{.+}}), %{{.+}}
     34 ; BMI2: ret
     35 ; BMI264: shl32p
     36 ; BMI264: shlxl %{{.+}}, ({{.+}}), %{{.+}}
     37 ; BMI264: ret
     38   ret i32 %shl
     39 }
     40 
     41 define i32 @shl32pi(i32* %p) nounwind uwtable readnone {
     42 entry:
     43   %x = load i32* %p
     44   %shl = shl i32 %x, 5
     45 ; BMI2: shl32pi
     46 ; BMI2-NOT: shlxl
     47 ; BMI2: ret
     48 ; BMI264: shl32pi
     49 ; BMI264-NOT: shlxl
     50 ; BMI264: ret
     51   ret i32 %shl
     52 }
     53 
     54 define i64 @shl64(i64 %x, i64 %shamt) nounwind uwtable readnone {
     55 entry:
     56   %shl = shl i64 %x, %shamt
     57 ; BMI264: shl64
     58 ; BMI264: shlxq
     59 ; BMI264: ret
     60   ret i64 %shl
     61 }
     62 
     63 define i64 @shl64i(i64 %x) nounwind uwtable readnone {
     64 entry:
     65   %shl = shl i64 %x, 7
     66 ; BMI264: shl64i
     67 ; BMI264-NOT: shlxq
     68 ; BMI264: ret
     69   ret i64 %shl
     70 }
     71 
     72 define i64 @shl64p(i64* %p, i64 %shamt) nounwind uwtable readnone {
     73 entry:
     74   %x = load i64* %p
     75   %shl = shl i64 %x, %shamt
     76 ; BMI264: shl64p
     77 ; BMI264: shlxq %{{.+}}, ({{.+}}), %{{.+}}
     78 ; BMI264: ret
     79   ret i64 %shl
     80 }
     81 
     82 define i64 @shl64pi(i64* %p) nounwind uwtable readnone {
     83 entry:
     84   %x = load i64* %p
     85   %shl = shl i64 %x, 7
     86 ; BMI264: shl64pi
     87 ; BMI264-NOT: shlxq
     88 ; BMI264: ret
     89   ret i64 %shl
     90 }
     91 
     92 define i32 @lshr32(i32 %x, i32 %shamt) nounwind uwtable readnone {
     93 entry:
     94   %shl = lshr i32 %x, %shamt
     95 ; BMI2: lshr32
     96 ; BMI2: shrxl
     97 ; BMI2: ret
     98 ; BMI264: lshr32
     99 ; BMI264: shrxl
    100 ; BMI264: ret
    101   ret i32 %shl
    102 }
    103 
    104 define i32 @lshr32p(i32* %p, i32 %shamt) nounwind uwtable readnone {
    105 entry:
    106   %x = load i32* %p
    107   %shl = lshr i32 %x, %shamt
    108 ; BMI2: lshr32p
    109 ; BMI2: shrxl %{{.+}}, ({{.+}}), %{{.+}}
    110 ; BMI2: ret
    111 ; BMI264: lshr32p
    112 ; BMI264: shrxl %{{.+}}, ({{.+}}), %{{.+}}
    113 ; BMI264: ret
    114   ret i32 %shl
    115 }
    116 
    117 define i64 @lshr64(i64 %x, i64 %shamt) nounwind uwtable readnone {
    118 entry:
    119   %shl = lshr i64 %x, %shamt
    120 ; BMI264: lshr64
    121 ; BMI264: shrxq
    122 ; BMI264: ret
    123   ret i64 %shl
    124 }
    125 
    126 define i64 @lshr64p(i64* %p, i64 %shamt) nounwind uwtable readnone {
    127 entry:
    128   %x = load i64* %p
    129   %shl = lshr i64 %x, %shamt
    130 ; BMI264: lshr64p
    131 ; BMI264: shrxq %{{.+}}, ({{.+}}), %{{.+}}
    132 ; BMI264: ret
    133   ret i64 %shl
    134 }
    135 
    136 define i32 @ashr32(i32 %x, i32 %shamt) nounwind uwtable readnone {
    137 entry:
    138   %shl = ashr i32 %x, %shamt
    139 ; BMI2: ashr32
    140 ; BMI2: sarxl
    141 ; BMI2: ret
    142 ; BMI264: ashr32
    143 ; BMI264: sarxl
    144 ; BMI264: ret
    145   ret i32 %shl
    146 }
    147 
    148 define i32 @ashr32p(i32* %p, i32 %shamt) nounwind uwtable readnone {
    149 entry:
    150   %x = load i32* %p
    151   %shl = ashr i32 %x, %shamt
    152 ; BMI2: ashr32p
    153 ; BMI2: sarxl %{{.+}}, ({{.+}}), %{{.+}}
    154 ; BMI2: ret
    155 ; BMI264: ashr32p
    156 ; BMI264: sarxl %{{.+}}, ({{.+}}), %{{.+}}
    157 ; BMI264: ret
    158   ret i32 %shl
    159 }
    160 
    161 define i64 @ashr64(i64 %x, i64 %shamt) nounwind uwtable readnone {
    162 entry:
    163   %shl = ashr i64 %x, %shamt
    164 ; BMI264: ashr64
    165 ; BMI264: sarxq
    166 ; BMI264: ret
    167   ret i64 %shl
    168 }
    169 
    170 define i64 @ashr64p(i64* %p, i64 %shamt) nounwind uwtable readnone {
    171 entry:
    172   %x = load i64* %p
    173   %shl = ashr i64 %x, %shamt
    174 ; BMI264: ashr64p
    175 ; BMI264: sarxq %{{.+}}, ({{.+}}), %{{.+}}
    176 ; BMI264: ret
    177   ret i64 %shl
    178 }
    179