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 signext i32 @test_igtss(i16 signext %a, i16 signext %b) {
12 ; CHECK-LABEL: test_igtss:
13 ; CHECK: # BB#0: # %entry
14 ; CHECK-NEXT: sub [[REG1:r[0-9]+]], r4, r3
15 ; CHECK-NEXT: rldicl r3, [[REG1]], 1, 63
18 %cmp = icmp sgt i16 %a, %b
19 %conv2 = zext i1 %cmp to i32
23 ; Function Attrs: norecurse nounwind readnone
24 define signext i32 @test_igtss_sext(i16 signext %a, i16 signext %b) {
25 ; CHECK-LABEL: test_igtss_sext:
26 ; CHECK: # BB#0: # %entry
27 ; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3
28 ; CHECK-NEXT: sradi r3, [[REG]], 63
31 %cmp = icmp sgt i16 %a, %b
32 %sub = sext i1 %cmp to i32
37 ; Function Attrs: norecurse nounwind readnone
38 define signext i32 @test_igtss_z(i16 signext %a) {
39 ; CHECK-LABEL: test_igtss_z:
40 ; CHECK: # BB#0: # %entry
41 ; CHECK-NEXT: neg r3, r3
42 ; CHECK-NEXT: rldicl r3, r3, 1, 63
45 %cmp = icmp sgt i16 %a, 0
46 %conv1 = zext i1 %cmp to i32
50 ; Function Attrs: norecurse nounwind readnone
51 define signext i32 @test_igtss_sext_z(i16 signext %a) {
52 ; CHECK-LABEL: test_igtss_sext_z:
53 ; CHECK: # BB#0: # %entry
54 ; CHECK: neg [[REG2:r[0-9]+]], r3
55 ; CHECK-NEXT: sradi r3, [[REG2]], 63
58 %cmp = icmp sgt i16 %a, 0
59 %sub = sext i1 %cmp to i32
63 ; Function Attrs: norecurse nounwind
64 define void @test_igtss_store(i16 signext %a, i16 signext %b) {
65 ; CHECK-LABEL: test_igtss_store:
66 ; CHECK: # BB#0: # %entry
67 ; CHECK: sub [[REG1:r[0-9]+]], r4, r3
68 ; CHECK: rldicl {{r[0-9]+}}, [[REG1]], 1, 63
70 %cmp = icmp sgt i16 %a, %b
71 %conv3 = zext i1 %cmp to i16
72 store i16 %conv3, i16* @glob, align 2
76 ; Function Attrs: norecurse nounwind
77 define void @test_igtss_sext_store(i16 signext %a, i16 signext %b) {
78 ; CHECK-LABEL: test_igtss_sext_store:
79 ; CHECK: # BB#0: # %entry
80 ; CHECK: sub [[REG:r[0-9]+]], r4, r3
81 ; CHECK: sradi {{r[0-9]+}}, [[REG]], 63
83 %cmp = icmp sgt i16 %a, %b
84 %conv3 = sext i1 %cmp to i16
85 store i16 %conv3, i16* @glob, align 2
90 ; Function Attrs: norecurse nounwind
91 define void @test_igtss_z_store(i16 signext %a) {
92 ; CHECK-LABEL: test_igtss_z_store:
93 ; CHECK: # BB#0: # %entry
94 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
95 ; CHECK-NEXT: neg r3, r3
96 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
97 ; CHECK-NEXT: rldicl r3, r3, 1, 63
98 ; CHECK-NEXT: sth r3, 0(r4)
101 %cmp = icmp sgt i16 %a, 0
102 %conv2 = zext i1 %cmp to i16
103 store i16 %conv2, i16* @glob, align 2
107 ; Function Attrs: norecurse nounwind
108 define void @test_igtss_sext_z_store(i16 signext %a) {
109 ; CHECK-LABEL: test_igtss_sext_z_store:
110 ; CHECK: neg [[REG2:r[0-9]+]], r3
111 ; CHECK: sradi {{r[0-9]+}}, [[REG2]], 63
113 %cmp = icmp sgt i16 %a, 0
114 %conv2 = sext i1 %cmp to i16
115 store i16 %conv2, i16* @glob, align 2