[PowerPC] Recommit r314244 with refactoring and off by default
[llvm-core.git] / test / CodeGen / PowerPC / testComparesllgeuc.ll
blob6369cdc23d9f85a90f987b096e58316861b567d2
1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
2 ; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
3 ; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
5 ; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
6 ; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
8 @glob = common local_unnamed_addr global i8 0, align 1
10 ; Function Attrs: norecurse nounwind readnone
11 define i64 @test_llgeuc(i8 zeroext %a, i8 zeroext %b) {
12 entry:
13   %cmp = icmp uge i8 %a, %b
14   %conv3 = zext i1 %cmp to i64
15   ret i64 %conv3
16 ; CHECK-LABEL: test_llgeuc:
17 ; CHECK: sub [[REG1:r[0-9]+]], r3, r4
18 ; CHECK: rldicl [[REG2:r[0-9]+]], [[REG2]], 1, 63
19 ; CHECK: xori r3, [[REG2]], 1
20 ; CHECK: blr
23 ; Function Attrs: norecurse nounwind readnone
24 define i64 @test_llgeuc_sext(i8 zeroext %a, i8 zeroext %b) {
25 entry:
26   %cmp = icmp uge i8 %a, %b
27   %conv3 = sext i1 %cmp to i64
28   ret i64 %conv3
29 ; CHECK-LABEL: @test_llgeuc_sext
30 ; CHECK: sub [[REG1:r[0-9]+]], r3, r4
31 ; CHECK-NEXT: rldicl [[REG2:r[0-9]+]], [[REG1]], 1, 63
32 ; CHECK-NEXT: addi [[REG3:r[0-9]+]], [[REG2]], -1
33 ; CHECK-NEXT: blr
36 ; Function Attrs: norecurse nounwind readnone
37 define i64 @test_llgeuc_z(i8 zeroext %a) {
38 entry:
39   %cmp = icmp uge i8 %a, 0
40   %conv1 = zext i1 %cmp to i64
41   ret i64 %conv1
42 ; CHECK-LABEL: @test_llgeuc_z
43 ; CHECK: li r3, 1
44 ; CHECK: blr
47 ; Function Attrs: norecurse nounwind readnone
48 define i64 @test_llgeuc_sext_z(i8 zeroext %a) {
49 entry:
50   %cmp = icmp uge i8 %a, 0
51   %conv1 = sext i1 %cmp to i64
52   ret i64 %conv1
53 ; CHECK-LABEL: @test_llgeuc_sext_z
54 ; CHECK: li r3, -1
55 ; CHECK-NEXT: blr
58 ; Function Attrs: norecurse nounwind
59 define void @test_llgeuc_store(i8 zeroext %a, i8 zeroext %b) {
60 entry:
61   %cmp = icmp uge i8 %a, %b
62   %conv3 = zext i1 %cmp to i8
63   store i8 %conv3, i8* @glob
64   ret void
65 ; CHECK_LABEL: test_llgeuc_store:
66 ; CHECK: sub [[REG1:r[0-9]+]], r3, r4
67 ; CHECK: rldicl [[REG2:r[0-9]+]], [[REG2]], 1, 63
68 ; CHECK: xori {{r[0-9]+}}, [[REG2]], 1
69 ; CHECK: blr
72 ; Function Attrs: norecurse nounwind
73 define void @test_llgeuc_sext_store(i8 zeroext %a, i8 zeroext %b) {
74 entry:
75   %cmp = icmp uge i8 %a, %b
76   %conv3 = sext i1 %cmp to i8
77   store i8 %conv3, i8* @glob
78   ret void
79 ; CHECK-LABEL: @test_llgeuc_sext_store
80 ; CHECK: sub [[REG1:r[0-9]+]], r3, r4
81 ; CHECK: rldicl [[REG2:r[0-9]+]], [[REG1]], 1, 63
82 ; CHECK: addi [[REG3:r[0-9]+]], [[REG2]], -1
83 ; CHECK: stb  [[REG3]]
84 ; CHECK: blr
87 ; Function Attrs: norecurse nounwind
88 define void @test_llgeuc_z_store(i8 zeroext %a) {
89 entry:
90   %cmp = icmp uge i8 %a, 0
91   %conv1 = zext i1 %cmp to i8
92   store i8 %conv1, i8* @glob
93   ret void
94 ; CHECK-LABEL: @test_llgeuc_z_store
95 ; CHECK: li [[REG1:r[0-9]+]], 1
96 ; CHECK: stb [[REG1]]
97 ; CHECK: blr
100 ; Function Attrs: norecurse nounwind
101 define void @test_llgeuc_sext_z_store(i8 zeroext %a) {
102 entry:
103   %cmp = icmp uge i8 %a, 0
104   %conv1 = sext i1 %cmp to i8
105   store i8 %conv1, i8* @glob
106   ret void
107 ; CHECK-LABEL: @test_llgeuc_sext_z_store
108 ; CHECK: li [[REG1:r[0-9]+]], 255
109 ; CHECK: stb [[REG1]]
110 ; CHECK: blr