blob: 39f37387f534f6e6e0f0726fe6d42192088cfed4 [file] [log] [blame]
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +00001; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
Nemanja Ivanovicdb7e7702017-11-30 13:39:10 +00002; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +00003; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
4; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
Nemanja Ivanovicdb7e7702017-11-30 13:39:10 +00005; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +00006; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
7; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
8
9@glob = common local_unnamed_addr global i32 0, align 4
10
11; Function Attrs: norecurse nounwind readnone
12define signext i32 @test_iltsi(i32 signext %a, i32 signext %b) {
13; CHECK-LABEL: test_iltsi:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000014; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000015; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4
16; CHECK-NEXT: rldicl r3, [[REG]], 1, 63
17; CHECK-NEXT: blr
18entry:
19 %cmp = icmp slt i32 %a, %b
20 %conv = zext i1 %cmp to i32
21 ret i32 %conv
22}
23
24; Function Attrs: norecurse nounwind readnone
25define signext i32 @test_iltsi_sext(i32 signext %a, i32 signext %b) {
26; CHECK-LABEL: test_iltsi_sext:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000027; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000028; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4
29; CHECK-NEXT: sradi r3, [[REG]], 63
30; CHECK-NEXT: blr
31entry:
32 %cmp = icmp slt i32 %a, %b
33 %sub = sext i1 %cmp to i32
34 ret i32 %sub
35}
36
37; Function Attrs: norecurse nounwind readnone
38define signext i32 @test_iltsi_sext_z(i32 signext %a) {
39; CHECK-LABEL: test_iltsi_sext_z:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000040; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000041; CHECK-NEXT: srawi r3, r3, 31
42; CHECK-NEXT: blr
43entry:
44 %cmp = icmp slt i32 %a, 0
45 %sub = sext i1 %cmp to i32
46 ret i32 %sub
47}
48
49; Function Attrs: norecurse nounwind
50define void @test_iltsi_store(i32 signext %a, i32 signext %b) {
51; CHECK-LABEL: test_iltsi_store:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000052; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000053; CHECK: sub [[REG:r[0-9]+]], r3, r4
54; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63
55entry:
56 %cmp = icmp slt i32 %a, %b
57 %conv = zext i1 %cmp to i32
58 store i32 %conv, i32* @glob, align 4
59 ret void
60}
61
62; Function Attrs: norecurse nounwind
63define void @test_iltsi_sext_store(i32 signext %a, i32 signext %b) {
64; CHECK-LABEL: test_iltsi_sext_store:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000065; CHECK: # %bb.0: # %entry
Nemanja Ivanovic41c4a102017-09-23 04:41:34 +000066; CHECK: sub [[REG:r[0-9]+]], r3, r4
67; CHECK: sradi {{r[0-9]+}}, [[REG]], 63
68entry:
69 %cmp = icmp slt i32 %a, %b
70 %sub = sext i1 %cmp to i32
71 store i32 %sub, i32* @glob, align 4
72 ret void
73}
74
75; Function Attrs: norecurse nounwind
76define void @test_iltsi_sext_z_store(i32 signext %a) {
77; CHECK-LABEL: test_iltsi_sext_z_store:
78; CHECK: srawi {{r[0-9]+}}, r3, 31
79; CHECK: blr
80entry:
81 %cmp = icmp slt i32 %a, 0
82 %sub = sext i1 %cmp to i32
83 store i32 %sub, i32* @glob, align 4
84 ret void
85}