AVX-512: added arithmetic and logical operations.
[oota-llvm.git] / test / CodeGen / X86 / legalize-shift-64.ll
1 ; RUN: llc -mcpu=generic -mtriple=i686-unknown-unknown < %s | FileCheck %s
2 define i64 @test1(i32 %xx, i32 %test) nounwind {
3   %conv = zext i32 %xx to i64
4   %and = and i32 %test, 7
5   %sh_prom = zext i32 %and to i64
6   %shl = shl i64 %conv, %sh_prom
7   ret i64 %shl
8 ; CHECK-LABEL: test1:
9 ; CHECK: shll   %cl, %eax
10 ; CHECK: shrl   %edx
11 ; CHECK: xorb   $31
12 ; CHECK: shrl   %cl, %edx
13 }
14
15 define i64 @test2(i64 %xx, i32 %test) nounwind {
16   %and = and i32 %test, 7
17   %sh_prom = zext i32 %and to i64
18   %shl = shl i64 %xx, %sh_prom
19   ret i64 %shl
20 ; CHECK-LABEL: test2:
21 ; CHECK: shll   %cl, %esi
22 ; CHECK: shrl   %edx
23 ; CHECK: xorb   $31
24 ; CHECK: shrl   %cl, %edx
25 ; CHECK: orl    %esi, %edx
26 ; CHECK: shll   %cl, %eax
27 }
28
29 define i64 @test3(i64 %xx, i32 %test) nounwind {
30   %and = and i32 %test, 7
31   %sh_prom = zext i32 %and to i64
32   %shr = lshr i64 %xx, %sh_prom
33   ret i64 %shr
34 ; CHECK-LABEL: test3:
35 ; CHECK: shrl   %cl, %esi
36 ; CHECK: leal   (%edx,%edx), %eax
37 ; CHECK: xorb   $31, %cl
38 ; CHECK: shll   %cl, %eax
39 ; CHECK: orl    %esi, %eax
40 ; CHECK: shrl   %cl, %edx
41 }
42
43 define i64 @test4(i64 %xx, i32 %test) nounwind {
44   %and = and i32 %test, 7
45   %sh_prom = zext i32 %and to i64
46   %shr = ashr i64 %xx, %sh_prom
47   ret i64 %shr
48 ; CHECK-LABEL: test4:
49 ; CHECK: shrl   %cl, %esi
50 ; CHECK: leal   (%edx,%edx), %eax
51 ; CHECK: xorb   $31, %cl
52 ; CHECK: shll   %cl, %eax
53 ; CHECK: orl    %esi, %eax
54 ; CHECK: sarl   %cl, %edx
55 }
56
57 ; PR14668
58 define <2 x i64> @test5(<2 x i64> %A, <2 x i64> %B) {
59   %shl = shl <2 x i64> %A, %B
60   ret <2 x i64> %shl
61 ; CHECK: test5
62 ; CHECK: shl
63 ; CHECK: shldl
64 ; CHECK: shl
65 ; CHECK: shldl
66 }