blob: 8009043c45d95ca7ab4b47ac089f62dae5621ee0 [file] [log] [blame]
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +00001; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
Nemanja Ivanovicdb7e7702017-11-30 13:39:10 +00002; 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
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +00004; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
Nemanja Ivanovicdb7e7702017-11-30 13:39:10 +00005; 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
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +00007
8@glob = common local_unnamed_addr global i8 0, align 1
9
10; Function Attrs: norecurse nounwind readnone
11define signext i32 @test_igtsc(i8 signext %a, i8 signext %b) {
12; CHECK-LABEL: test_igtsc:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000013; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000014; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3
15; CHECK-NEXT: rldicl r3, [[REG]], 1, 63
16; CHECK-NEXT: blr
17entry:
18 %cmp = icmp sgt i8 %a, %b
19 %conv2 = zext i1 %cmp to i32
20 ret i32 %conv2
21}
22
23; Function Attrs: norecurse nounwind readnone
24define signext i32 @test_igtsc_sext(i8 signext %a, i8 signext %b) {
25; CHECK-LABEL: test_igtsc_sext:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000026; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000027; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3
28; CHECK-NEXT: sradi r3, [[REG]], 63
29; CHECK-NEXT: blr
30entry:
31 %cmp = icmp sgt i8 %a, %b
32 %sub = sext i1 %cmp to i32
33 ret i32 %sub
34}
35
36; FIXME
37; Function Attrs: norecurse nounwind readnone
38define signext i32 @test_igtsc_z(i8 signext %a) {
39; CHECK-LABEL: test_igtsc_z:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000040; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000041; CHECK-NEXT: neg r3, r3
42; CHECK-NEXT: rldicl r3, r3, 1, 63
43; CHECK-NEXT: blr
44entry:
45 %cmp = icmp sgt i8 %a, 0
46 %conv1 = zext i1 %cmp to i32
47 ret i32 %conv1
48}
49
50; Function Attrs: norecurse nounwind readnone
51define signext i32 @test_igtsc_sext_z(i8 signext %a) {
52; CHECK-LABEL: test_igtsc_sext_z:
53; CHECK: neg [[REG2:r[0-9]+]], r3
54; CHECK-NEXT: sradi r3, [[REG2]], 63
55; CHECK-NEXT: blr
56entry:
57 %cmp = icmp sgt i8 %a, 0
58 %sub = sext i1 %cmp to i32
59 ret i32 %sub
60}
61
62; Function Attrs: norecurse nounwind
63define void @test_igtsc_store(i8 signext %a, i8 signext %b) {
64; CHECK-LABEL: test_igtsc_store:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000065; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000066; CHECK: sub [[REG:r[0-9]+]], r4, r3
67; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63
68entry:
69 %cmp = icmp sgt i8 %a, %b
70 %conv3 = zext i1 %cmp to i8
71 store i8 %conv3, i8* @glob, align 1
72 ret void
73}
74
75; Function Attrs: norecurse nounwind
76define void @test_igtsc_sext_store(i8 signext %a, i8 signext %b) {
77; CHECK-LABEL: test_igtsc_sext_store:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000078; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000079; CHECK: sub [[REG:r[0-9]+]], r4, r3
80; CHECK: sradi {{r[0-9]+}}, [[REG]], 63
81entry:
82 %cmp = icmp sgt i8 %a, %b
83 %conv3 = sext i1 %cmp to i8
84 store i8 %conv3, i8* @glob, align 1
85 ret void
86}
87
88; FIXME
89; Function Attrs: norecurse nounwind
90define void @test_igtsc_z_store(i8 signext %a) {
91; CHECK-LABEL: test_igtsc_z_store:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000092; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000093; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
94; CHECK-NEXT: neg r3, r3
95; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
96; CHECK-NEXT: rldicl r3, r3, 1, 63
97; CHECK-NEXT: stb r3, 0(r4)
98; CHECK-NEXT: blr
99entry:
100 %cmp = icmp sgt i8 %a, 0
101 %conv2 = zext i1 %cmp to i8
102 store i8 %conv2, i8* @glob, align 1
103 ret void
104}
105
106; Function Attrs: norecurse nounwind
107define void @test_igtsc_sext_z_store(i8 signext %a) {
108; CHECK-LABEL: test_igtsc_sext_z_store:
109; CHECK: neg [[REG2:r[0-9]+]], r3
110; CHECK: sradi {{r[0-9]+}}, [[REG2]], 63
111entry:
112 %cmp = icmp sgt i8 %a, 0
113 %conv2 = sext i1 %cmp to i8
114 store i8 %conv2, i8* @glob, align 1
115 ret void
116}