1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
3 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
4 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
5 ; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
6 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
7 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
9 @glob = local_unnamed_addr global i16 0, align 2
11 ; Function Attrs: norecurse nounwind readnone
12 define signext i32 @test_igtss(i16 signext %a, i16 signext %b) {
13 ; CHECK-LABEL: test_igtss:
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: sub r3, r4, r3
16 ; CHECK-NEXT: rldicl r3, r3, 1, 63
19 %cmp = icmp sgt i16 %a, %b
20 %conv2 = zext i1 %cmp to i32
24 ; Function Attrs: norecurse nounwind readnone
25 define signext i32 @test_igtss_sext(i16 signext %a, i16 signext %b) {
26 ; CHECK-LABEL: test_igtss_sext:
27 ; CHECK: # %bb.0: # %entry
28 ; CHECK-NEXT: sub r3, r4, r3
29 ; CHECK-NEXT: sradi r3, r3, 63
32 %cmp = icmp sgt i16 %a, %b
33 %sub = sext i1 %cmp to i32
38 ; Function Attrs: norecurse nounwind readnone
39 define signext i32 @test_igtss_z(i16 signext %a) {
40 ; CHECK-LABEL: test_igtss_z:
41 ; CHECK: # %bb.0: # %entry
42 ; CHECK-NEXT: neg r3, r3
43 ; CHECK-NEXT: rldicl r3, r3, 1, 63
46 %cmp = icmp sgt i16 %a, 0
47 %conv1 = zext i1 %cmp to i32
51 ; Function Attrs: norecurse nounwind readnone
52 define signext i32 @test_igtss_sext_z(i16 signext %a) {
53 ; CHECK-LABEL: test_igtss_sext_z:
54 ; CHECK: # %bb.0: # %entry
55 ; CHECK-NEXT: neg r3, r3
56 ; CHECK-NEXT: sradi r3, r3, 63
59 %cmp = icmp sgt i16 %a, 0
60 %sub = sext i1 %cmp to i32
64 ; Function Attrs: norecurse nounwind
65 define void @test_igtss_store(i16 signext %a, i16 signext %b) {
66 ; CHECK-LABEL: test_igtss_store:
67 ; CHECK: # %bb.0: # %entry
68 ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha
69 ; CHECK-NEXT: sub r3, r4, r3
70 ; CHECK-NEXT: ld r5, .LC0@toc@l(r5)
71 ; CHECK-NEXT: rldicl r3, r3, 1, 63
72 ; CHECK-NEXT: sth r3, 0(r5)
75 %cmp = icmp sgt i16 %a, %b
76 %conv3 = zext i1 %cmp to i16
77 store i16 %conv3, i16* @glob, align 2
81 ; Function Attrs: norecurse nounwind
82 define void @test_igtss_sext_store(i16 signext %a, i16 signext %b) {
83 ; CHECK-LABEL: test_igtss_sext_store:
84 ; CHECK: # %bb.0: # %entry
85 ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha
86 ; CHECK-NEXT: sub r3, r4, r3
87 ; CHECK-NEXT: ld r5, .LC0@toc@l(r5)
88 ; CHECK-NEXT: sradi r3, r3, 63
89 ; CHECK-NEXT: sth r3, 0(r5)
92 %cmp = icmp sgt i16 %a, %b
93 %conv3 = sext i1 %cmp to i16
94 store i16 %conv3, i16* @glob, align 2
99 ; Function Attrs: norecurse nounwind
100 define void @test_igtss_z_store(i16 signext %a) {
101 ; CHECK-LABEL: test_igtss_z_store:
102 ; CHECK: # %bb.0: # %entry
103 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
104 ; CHECK-NEXT: neg r3, r3
105 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
106 ; CHECK-NEXT: rldicl r3, r3, 1, 63
107 ; CHECK-NEXT: sth r3, 0(r4)
110 %cmp = icmp sgt i16 %a, 0
111 %conv2 = zext i1 %cmp to i16
112 store i16 %conv2, i16* @glob, align 2
116 ; Function Attrs: norecurse nounwind
117 define void @test_igtss_sext_z_store(i16 signext %a) {
118 ; CHECK-LABEL: test_igtss_sext_z_store:
119 ; CHECK: # %bb.0: # %entry
120 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
121 ; CHECK-NEXT: neg r3, r3
122 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
123 ; CHECK-NEXT: sradi r3, r3, 63
124 ; CHECK-NEXT: sth r3, 0(r4)
127 %cmp = icmp sgt i16 %a, 0
128 %conv2 = sext i1 %cmp to i16
129 store i16 %conv2, i16* @glob, align 2