1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -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: --check-prefixes=CHECK,BE
6 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
7 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
8 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl \
9 ; RUN: --check-prefixes=CHECK,LE
11 @glob = local_unnamed_addr global i32 0, align 4
13 ; Function Attrs: norecurse nounwind readnone
14 define signext i32 @test_iltsi(i32 signext %a, i32 signext %b) {
15 ; CHECK-LABEL: test_iltsi:
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: sub r3, r3, r4
18 ; CHECK-NEXT: rldicl r3, r3, 1, 63
21 %cmp = icmp slt i32 %a, %b
22 %conv = zext i1 %cmp to i32
26 ; Function Attrs: norecurse nounwind readnone
27 define signext i32 @test_iltsi_sext(i32 signext %a, i32 signext %b) {
28 ; CHECK-LABEL: test_iltsi_sext:
29 ; CHECK: # %bb.0: # %entry
30 ; CHECK-NEXT: sub r3, r3, r4
31 ; CHECK-NEXT: sradi r3, r3, 63
34 %cmp = icmp slt i32 %a, %b
35 %sub = sext i1 %cmp to i32
39 ; Function Attrs: norecurse nounwind readnone
40 define signext i32 @test_iltsi_sext_z(i32 signext %a) {
41 ; CHECK-LABEL: test_iltsi_sext_z:
42 ; CHECK: # %bb.0: # %entry
43 ; CHECK-NEXT: srawi r3, r3, 31
46 %cmp = icmp slt i32 %a, 0
47 %sub = sext i1 %cmp to i32
51 ; Function Attrs: norecurse nounwind
52 define void @test_iltsi_store(i32 signext %a, i32 signext %b) {
53 ; BE-LABEL: test_iltsi_store:
54 ; BE: # %bb.0: # %entry
55 ; BE-NEXT: addis r5, r2, .LC0@toc@ha
56 ; BE-NEXT: sub r3, r3, r4
57 ; BE-NEXT: ld r5, .LC0@toc@l(r5)
58 ; BE-NEXT: rldicl r3, r3, 1, 63
59 ; BE-NEXT: stw r3, 0(r5)
62 ; LE-LABEL: test_iltsi_store:
63 ; LE: # %bb.0: # %entry
64 ; LE-NEXT: sub r3, r3, r4
65 ; LE-NEXT: addis r5, r2, glob@toc@ha
66 ; LE-NEXT: rldicl r3, r3, 1, 63
67 ; LE-NEXT: stw r3, glob@toc@l(r5)
70 %cmp = icmp slt i32 %a, %b
71 %conv = zext i1 %cmp to i32
72 store i32 %conv, i32* @glob, align 4
76 ; Function Attrs: norecurse nounwind
77 define void @test_iltsi_sext_store(i32 signext %a, i32 signext %b) {
78 ; BE-LABEL: test_iltsi_sext_store:
79 ; BE: # %bb.0: # %entry
80 ; BE-NEXT: addis r5, r2, .LC0@toc@ha
81 ; BE-NEXT: sub r3, r3, r4
82 ; BE-NEXT: ld r5, .LC0@toc@l(r5)
83 ; BE-NEXT: sradi r3, r3, 63
84 ; BE-NEXT: stw r3, 0(r5)
87 ; LE-LABEL: test_iltsi_sext_store:
88 ; LE: # %bb.0: # %entry
89 ; LE-NEXT: sub r3, r3, r4
90 ; LE-NEXT: addis r5, r2, glob@toc@ha
91 ; LE-NEXT: sradi r3, r3, 63
92 ; LE-NEXT: stw r3, glob@toc@l(r5)
95 %cmp = icmp slt i32 %a, %b
96 %sub = sext i1 %cmp to i32
97 store i32 %sub, i32* @glob, align 4
101 ; Function Attrs: norecurse nounwind
102 define void @test_iltsi_sext_z_store(i32 signext %a) {
103 ; BE-LABEL: test_iltsi_sext_z_store:
104 ; BE: # %bb.0: # %entry
105 ; BE-NEXT: addis r4, r2, .LC0@toc@ha
106 ; BE-NEXT: srawi r3, r3, 31
107 ; BE-NEXT: ld r4, .LC0@toc@l(r4)
108 ; BE-NEXT: stw r3, 0(r4)
111 ; LE-LABEL: test_iltsi_sext_z_store:
112 ; LE: # %bb.0: # %entry
113 ; LE-NEXT: addis r4, r2, glob@toc@ha
114 ; LE-NEXT: srawi r3, r3, 31
115 ; LE-NEXT: stw r3, glob@toc@l(r4)
118 %cmp = icmp slt i32 %a, 0
119 %sub = sext i1 %cmp to i32
120 store i32 %sub, i32* @glob, align 4