blob: 32758e163790f0876f7f719fc544c1cd5ff9ff43 [file] [log] [blame]
Nemanja Ivanovic35db4f92017-09-23 12:53:03 +00001; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
2; RUN: -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-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
6; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
7
8@glob = common local_unnamed_addr global i32 0, align 4
9
10; Function Attrs: norecurse nounwind readnone
11define signext i32 @test_iltui(i32 zeroext %a, i32 zeroext %b) {
12; CHECK-LABEL: test_iltui:
13; CHECK: sub [[REG:r[0-9]+]], r3, r4
14; CHECK-NEXT: rldicl r3, [[REG]], 1, 63
15; CHECK-NEXT: blr
16entry:
17 %cmp = icmp ult i32 %a, %b
18 %conv = zext i1 %cmp to i32
19 ret i32 %conv
20}
21
22; Function Attrs: norecurse nounwind readnone
23define signext i32 @test_iltui_sext(i32 zeroext %a, i32 zeroext %b) {
24; CHECK-LABEL: test_iltui_sext:
25; CHECK: sub [[REG:r[0-9]+]], r3, r4
26; CHECK-NEXT: sradi r3, [[REG]], 63
27; CHECK-NEXT: blr
28entry:
29 %cmp = icmp ult i32 %a, %b
30 %sub = sext i1 %cmp to i32
31 ret i32 %sub
32}
33
34; Function Attrs: norecurse nounwind
35define void @test_iltui_store(i32 zeroext %a, i32 zeroext %b) {
36; CHECK-LABEL: test_iltui_store:
37; CHECK: sub [[REG:r[2-9]+]], r3, r4
38; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63
39entry:
40 %cmp = icmp ult i32 %a, %b
41 %conv = zext i1 %cmp to i32
42 store i32 %conv, i32* @glob, align 4
43 ret void
44}
45
46; Function Attrs: norecurse nounwind
47define void @test_iltui_sext_store(i32 zeroext %a, i32 zeroext %b) {
48; CHECK-LABEL: test_iltui_sext_store:
49; CHECK: sub [[REG:r[0-9]+]], r3, r4
50; CHECK: sradi {{r[0-9]+}}, [[REG]], 63
51entry:
52 %cmp = icmp ult i32 %a, %b
53 %sub = sext i1 %cmp to i32
54 store i32 %sub, i32* @glob, align 4
55 ret void
56}