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 i64 0, align 8
10 ; Function Attrs: norecurse nounwind readnone
11 define signext i32 @test_ileull(i64 %a, i64 %b) {
13 %cmp = icmp ule i64 %a, %b
14 %conv = zext i1 %cmp to i32
16 ; CHECK-LABEL: test_ileull:
17 ; CHECK: subfc {{r[0-9]+}}, r3, r4
18 ; CHECK-NEXT: subfe [[REG1:r[0-9]+]], r3, r3
19 ; CHECK-NEXT: addi r3, [[REG1]], 1
23 ; Function Attrs: norecurse nounwind readnone
24 define signext i32 @test_ileull_sext(i64 %a, i64 %b) {
26 %cmp = icmp ule i64 %a, %b
27 %sub = sext i1 %cmp to i32
29 ; CHECK-LABEL: @test_ileull_sext
30 ; CHECK: subfc [[REG1:r[0-9]+]], r3, r4
31 ; CHECK: subfe [[REG2:r[0-9]+]], {{r[0-9]+}}, {{r[0-9]+}}
32 ; CHECK: not r3, [[REG2]]
36 ; Function Attrs: norecurse nounwind readnone
37 define signext i32 @test_ileull_z(i64 %a) {
39 %cmp = icmp ule i64 %a, 0
40 %conv = zext i1 %cmp to i32
42 ; CHECK-LABEL: test_ileull_z
43 ; CHECK: cntlzd [[REG1:r[0-9]+]], r3
44 ; CHECK-NEXT: rldicl r3, [[REG1]], 58, 63
48 ; Function Attrs: norecurse nounwind readnone
49 define signext i32 @test_ileull_sext_z(i64 %a) {
51 %cmp = icmp ule i64 %a, 0
52 %sub = sext i1 %cmp to i32
54 ; CHECK-LABEL: @test_ileull_sext_z
55 ; CHECK: addic [[REG1:r[0-9]+]], r3, -1
56 ; CHECK: subfe r3, [[REG1]]
60 ; Function Attrs: norecurse nounwind
61 define void @test_ileull_store(i64 %a, i64 %b) {
63 %cmp = icmp ule i64 %a, %b
64 %conv1 = zext i1 %cmp to i64
65 store i64 %conv1, i64* @glob
67 ; CHECK-LABEL: test_ileull_store:
68 ; CHECK: subfc {{r[0-9]+}}, r3, r4
69 ; CHECK: subfe [[REG1:r[0-9]+]], r3, r3
70 ; CHECK: addi {{r[0-9]+}}, [[REG1]], 1
74 ; Function Attrs: norecurse nounwind
75 define void @test_ileull_sext_store(i64 %a, i64 %b) {
77 %cmp = icmp ule i64 %a, %b
78 %conv1 = sext i1 %cmp to i64
79 store i64 %conv1, i64* @glob
81 ; CHECK-LABEL: @test_ileull_sext_store
82 ; CHECK: subfc [[REG1:r[0-9]+]], r3, r4
83 ; CHECK: subfe [[REG2:r[0-9]+]], {{r[0-9]+}}, {{r[0-9]+}}
84 ; CHECK: not [[REG3:r[0-9]+]], [[REG2]]
89 ; Function Attrs: norecurse nounwind
90 define void @test_ileull_z_store(i64 %a) {
92 %cmp = icmp ule i64 %a, 0
93 %conv1 = zext i1 %cmp to i64
94 store i64 %conv1, i64* @glob
96 ; CHECK-LABEL: test_ileull_z_store:
97 ; CHECK: cntlzd [[REG1:r[0-9]+]], r3
98 ; CHECK: rldicl {{r[0-9]+}}, [[REG1]], 58, 63
102 ; Function Attrs: norecurse nounwind
103 define void @test_ileull_sext_z_store(i64 %a) {
105 %cmp = icmp ule i64 %a, 0
106 %conv1 = sext i1 %cmp to i64
107 store i64 %conv1, i64* @glob
109 ; CHECK-LABEL: @test_ileull_sext_z_store
110 ; CHECK: addic [[REG1:r[0-9]+]], r3, -1
111 ; CHECK: subfe [[REG2:r[0-9]+]], {{r[0-9]+}}, {{r[0-9]+}}
112 ; CHECK: std [[REG2]]