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 i16 0, align 2
10 ; Function Attrs: norecurse nounwind readnone
11 define i64 @test_llleus(i16 zeroext %a, i16 zeroext %b) {
13 %cmp = icmp ule i16 %a, %b
14 %conv3 = zext i1 %cmp to i64
16 ; CHECK-LABEL: test_llleus:
17 ; CHECK: sub [[REG1:r[0-9]+]], r4, r3
18 ; CHECK-NEXT: not [[REG2:r[0-9]+]], [[REG1]]
19 ; CHECK-NEXT: rldicl r3, [[REG2]], 1, 63
23 ; Function Attrs: norecurse nounwind readnone
24 define i64 @test_llleus_sext(i16 zeroext %a, i16 zeroext %b) {
26 %cmp = icmp ule i16 %a, %b
27 %conv3 = sext i1 %cmp to i64
29 ; CHECK-LABEL: @test_llleus_sext
30 ; CHECK: sub [[REG1:r[0-9]+]], r4, r3
31 ; CHECK-NEXT: rldicl [[REG2:r[0-9]+]], [[REG1]], 1, 63
32 ; CHECK-NEXT: addi [[REG3:r[0-9]+]], [[REG2]], -1
36 ; Function Attrs: norecurse nounwind readnone
37 define i64 @test_llleus_z(i16 zeroext %a) {
39 %cmp = icmp ule i16 %a, 0
40 %conv2 = zext i1 %cmp to i64
42 ; CHECK-LABEL: test_llleus_z:
43 ; CHECK: cntlzw r3, r3
44 ; CHECK-NEXT: srwi r3, r3, 5
48 ; Function Attrs: norecurse nounwind readnone
49 define i64 @test_llleus_sext_z(i16 zeroext %a) {
51 %cmp = icmp ule i16 %a, 0
52 %conv2 = sext i1 %cmp to i64
54 ; CHECK-LABEL: @test_llleus_sext_z
55 ; CHECK: cntlzw [[REG1:r[0-9]+]], r3
56 ; CHECK-NEXT: srwi [[REG2:r[0-9]+]], [[REG1]], 5
57 ; CHECK-NEXT: neg r3, [[REG2]]
61 ; Function Attrs: norecurse nounwind
62 define void @test_llleus_store(i16 zeroext %a, i16 zeroext %b) {
64 %cmp = icmp ule i16 %a, %b
65 %conv3 = zext i1 %cmp to i16
66 store i16 %conv3, i16* @glob
68 ; CHECK-LABEL: test_llleus_store:
69 ; CHECK: sub [[REG1:r[0-9]+]], r4, r3
70 ; CHECK: not [[REG2:r[0-9]+]], [[REG1]]
71 ; CHECK-NEXT: rldicl r3, [[REG2]], 1, 63
75 ; Function Attrs: norecurse nounwind
76 define void @test_llleus_sext_store(i16 zeroext %a, i16 zeroext %b) {
78 %cmp = icmp ule i16 %a, %b
79 %conv3 = sext i1 %cmp to i16
80 store i16 %conv3, i16* @glob
82 ; CHECK-LABEL: @test_llleus_sext_store
83 ; CHECK: sub [[REG1:r[0-9]+]], r4, r3
84 ; CHECK: rldicl [[REG2:r[0-9]+]], [[REG1]], 1, 63
85 ; CHECK: addi [[REG3:r[0-9]+]], [[REG2]], -1
90 ; Function Attrs: norecurse nounwind
91 define void @test_llleus_z_store(i16 zeroext %a) {
93 %cmp = icmp ule i16 %a, 0
94 %conv2 = zext i1 %cmp to i16
95 store i16 %conv2, i16* @glob
97 ; CHECK-LABEL: test_llleus_z_store:
98 ; CHECK: cntlzw r3, r3
99 ; CHECK: srwi r3, r3, 5
103 ; Function Attrs: norecurse nounwind
104 define void @test_llleus_sext_z_store(i16 zeroext %a) {
106 %cmp = icmp ule i16 %a, 0
107 %conv2 = sext i1 %cmp to i16
108 store i16 %conv2, i16* @glob
110 ; CHECK-LABEL: @test_llleus_sext_z_store
111 ; CHECK: cntlzw [[REG1:r[0-9]+]], r3
112 ; CHECK: srwi [[REG2:r[0-9]+]], [[REG1]], 5
113 ; CHECK: neg [[REG3:r[0-9]+]], [[REG2]]
114 ; CHECK: sth [[REG3]]