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_igeull(i64 %a, i64 %b) {
13 %cmp = icmp uge i64 %a, %b
14 %conv = zext i1 %cmp to i32
16 ; CHECK-LABEL: test_igeull:
17 ; CHECK: subfc {{r[0-9]+}}, r4, r3
18 ; CHECK-NEXT: subfe [[REG1:r[0-9]+]], r4, r4
19 ; CHECK-NEXT: addi r3, [[REG1]], 1
23 ; Function Attrs: norecurse nounwind readnone
24 define signext i32 @test_igeull_sext(i64 %a, i64 %b) {
26 %cmp = icmp uge i64 %a, %b
27 %sub = sext i1 %cmp to i32
29 ; CHECK-LABEL: @test_igeull_sext
30 ; CHECK: subfc [[REG1:r[0-9]+]], r4, r3
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_igeull_z(i64 %a) {
39 %cmp = icmp uge i64 %a, 0
40 %sub = zext i1 %cmp to i32
42 ; CHECK-LABEL: @test_igeull_z
47 ; Function Attrs: norecurse nounwind readnone
48 define signext i32 @test_igeull_sext_z(i64 %a) {
50 %cmp = icmp uge i64 %a, 0
51 %sub = sext i1 %cmp to i32
53 ; CHECK-LABEL: @test_igeull_sext_z
58 ; Function Attrs: norecurse nounwind
59 define void @test_igeull_store(i64 %a, i64 %b) {
61 %cmp = icmp uge i64 %a, %b
62 %conv1 = zext i1 %cmp to i64
63 store i64 %conv1, i64* @glob
65 ; CHECK-LABEL: test_igeull_store:
66 ; CHECK: subfc {{r[0-9]+}}, r4, r3
67 ; CHECK: subfe [[REG1:r[0-9]+]], r4, r4
68 ; CHECK: addi {{r[0-9]+}}, [[REG1]], 1
72 ; Function Attrs: norecurse nounwind
73 define void @test_igeull_sext_store(i64 %a, i64 %b) {
75 %cmp = icmp uge i64 %a, %b
76 %conv1 = sext i1 %cmp to i64
77 store i64 %conv1, i64* @glob
79 ; CHECK-LABEL: @test_igeull_sext_store
80 ; CHECK: subfc [[REG1:r[0-9]+]], r4, r3
81 ; CHECK: subfe [[REG2:r[0-9]+]], {{r[0-9]+}}, {{r[0-9]+}}
82 ; CHECK: not [[REG3:r[0-9]+]], [[REG2]]
87 ; Function Attrs: norecurse nounwind
88 define void @test_igeull_z_store(i64 %a) {
90 %cmp = icmp uge i64 %a, 0
91 %conv1 = zext i1 %cmp to i64
92 store i64 %conv1, i64* @glob
94 ; CHECK-LABEL: @test_igeull_z_store
95 ; CHECK: li [[REG1:r[0-9]+]], 1
100 ; Function Attrs: norecurse nounwind
101 define void @test_igeull_sext_z_store(i64 %a) {
103 %cmp = icmp uge i64 %a, 0
104 %conv1 = sext i1 %cmp to i64
105 store i64 %conv1, i64* @glob
107 ; CHECK-LABEL: @test_igeull_sext_z_store
108 ; CHECK: li [[REG1:r[0-9]+]], -1
109 ; CHECK: std [[REG1]]