blob: 4520ca3ead5973ac34aa229ce963cc47e9912b46 [file] [log] [blame]
Nemanja Ivanovicc4980792017-09-23 09:50:12 +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 \
Nemanja Ivanovicc4980792017-09-23 09:50:12 +00003; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
4; 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 \
Nemanja Ivanovicc4980792017-09-23 09:50:12 +00006; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
7
8@glob = common local_unnamed_addr global i16 0, align 2
9
10; Function Attrs: norecurse nounwind readnone
11define i64 @test_llgeus(i16 zeroext %a, i16 zeroext %b) {
12entry:
13 %cmp = icmp uge i16 %a, %b
14 %conv3 = zext i1 %cmp to i64
15 ret i64 %conv3
16; CHECK-LABEL: test_llgeus:
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
21}
22
23; Function Attrs: norecurse nounwind readnone
24define i64 @test_llgeus_sext(i16 zeroext %a, i16 zeroext %b) {
25entry:
26 %cmp = icmp uge i16 %a, %b
27 %conv3 = sext i1 %cmp to i64
28 ret i64 %conv3
29; CHECK-LABEL: @test_llgeus_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
34}
35
36; Function Attrs: norecurse nounwind readnone
37define i64 @test_llgeus_z(i16 zeroext %a) {
38entry:
39 %cmp = icmp uge i16 %a, 0
40 %conv1 = zext i1 %cmp to i64
41 ret i64 %conv1
42; CHECK-LABEL: @test_llgeus_z
43; CHECK: li r3, 1
44; CHECK-NEXT: blr
45}
46
47; Function Attrs: norecurse nounwind readnone
48define i64 @test_llgeus_sext_z(i16 zeroext %a) {
49entry:
50 %cmp = icmp uge i16 %a, 0
51 %conv1 = sext i1 %cmp to i64
52 ret i64 %conv1
53; CHECK-LABEL: @test_llgeus_sext_z
54; CHECK: li r3, -1
55; CHECK: blr
56}
57
58; Function Attrs: norecurse nounwind
59define void @test_llgeus_store(i16 zeroext %a, i16 zeroext %b) {
60entry:
61 %cmp = icmp uge i16 %a, %b
62 %conv3 = zext i1 %cmp to i16
63 store i16 %conv3, i16* @glob
64 ret void
65; CHECK_LABEL: test_llgeus_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
70}
71
72; Function Attrs: norecurse nounwind
73define void @test_llgeus_sext_store(i16 zeroext %a, i16 zeroext %b) {
74entry:
75 %cmp = icmp uge i16 %a, %b
76 %conv3 = sext i1 %cmp to i16
77 store i16 %conv3, i16* @glob
78 ret void
79; CHECK-LABEL: @test_llgeus_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: sth [[REG3]]
84; CHECK: blr
85}
86
87; Function Attrs: norecurse nounwind
88define void @test_llgeus_z_store(i16 zeroext %a) {
89entry:
90 %cmp = icmp uge i16 %a, 0
91 %conv1 = zext i1 %cmp to i16
92 store i16 %conv1, i16* @glob
93 ret void
94; CHECK-LABEL: @test_llgeus_z_store
95; CHECK: li [[REG1:r[0-9]+]], 1
96; CHECK: sth [[REG1]]
97; CHECK: blr
98}
99
100; Function Attrs: norecurse nounwind
101define void @test_llgeus_sext_z_store(i16 zeroext %a) {
102entry:
103 %cmp = icmp uge i16 %a, 0
104 %conv1 = sext i1 %cmp to i16
105 store i16 %conv1, i16* @glob
106 ret void
107; CHECK-LABEL: @test_llgeus_sext_z_store
Nemanja Ivanovicb0783cc2017-12-12 12:09:34 +0000108; CHECK: li [[REG1:r[0-9]+]], -1
109; CHECK: sth [[REG1]]
Nemanja Ivanovicc4980792017-09-23 09:50:12 +0000110; CHECK: blr
111}
112