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
4 define i32 @shl32(i32 %x, i32 %shamt) nounwind uwtable readnone {
6 %shl = shl i32 %x, %shamt
16 define i32 @shl32i(i32 %x) nounwind uwtable readnone {
28 define i32 @shl32p(i32* %p, i32 %shamt) nounwind uwtable readnone {
31 %shl = shl i32 %x, %shamt
33 ; Source order scheduling prevents folding, rdar:14208996.
34 ; BMI2: shlxl %{{.+}}, %{{.+}}, %{{.+}}
37 ; BMI264: shlxl %{{.+}}, %{{.+}}, %{{.+}}
42 define i32 @shl32pi(i32* %p) nounwind uwtable readnone {
55 define i64 @shl64(i64 %x, i64 %shamt) nounwind uwtable readnone {
57 %shl = shl i64 %x, %shamt
64 define i64 @shl64i(i64 %x) nounwind uwtable readnone {
73 define i64 @shl64p(i64* %p, i64 %shamt) nounwind uwtable readnone {
76 %shl = shl i64 %x, %shamt
78 ; BMI264: shlxq %{{.+}}, %{{.+}}, %{{.+}}
83 define i64 @shl64pi(i64* %p) nounwind uwtable readnone {
93 define i32 @lshr32(i32 %x, i32 %shamt) nounwind uwtable readnone {
95 %shl = lshr i32 %x, %shamt
105 define i32 @lshr32p(i32* %p, i32 %shamt) nounwind uwtable readnone {
108 %shl = lshr i32 %x, %shamt
110 ; Source order scheduling prevents folding, rdar:14208996.
111 ; BMI2: shrxl %{{.+}}, %{{.+}}, %{{.+}}
114 ; BMI264: shrxl %{{.+}}, %{{.+}}, %{{.+}}
119 define i64 @lshr64(i64 %x, i64 %shamt) nounwind uwtable readnone {
121 %shl = lshr i64 %x, %shamt
128 define i64 @lshr64p(i64* %p, i64 %shamt) nounwind uwtable readnone {
131 %shl = lshr i64 %x, %shamt
133 ; BMI264: shrxq %{{.+}}, %{{.+}}, %{{.+}}
138 define i32 @ashr32(i32 %x, i32 %shamt) nounwind uwtable readnone {
140 %shl = ashr i32 %x, %shamt
150 define i32 @ashr32p(i32* %p, i32 %shamt) nounwind uwtable readnone {
153 %shl = ashr i32 %x, %shamt
155 ; Source order scheduling prevents folding, rdar:14208996.
156 ; BMI2: sarxl %{{.+}}, %{{.+}}, %{{.+}}
159 ; BMI264: sarxl %{{.+}}, %{{.+}}, %{{.+}}
164 define i64 @ashr64(i64 %x, i64 %shamt) nounwind uwtable readnone {
166 %shl = ashr i64 %x, %shamt
173 define i64 @ashr64p(i64* %p, i64 %shamt) nounwind uwtable readnone {
176 %shl = ashr i64 %x, %shamt
178 ; BMI264: sarxq %{{.+}}, %{{.+}}, %{{.+}}