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
10
11@glob = dso_local local_unnamed_addr global i32 0, align 4
12
13; Function Attrs: norecurse nounwind readnone
14define dso_local signext i32 @test_iltui(i32 zeroext %a, i32 zeroext %b) {
15; CHECK-LABEL: test_iltui:
16; CHECK:       # %bb.0: # %entry
17; CHECK-NEXT:    sub r3, r3, r4
18; CHECK-NEXT:    rldicl r3, r3, 1, 63
19; CHECK-NEXT:    blr
20entry:
21  %cmp = icmp ult i32 %a, %b
22  %conv = zext i1 %cmp to i32
23  ret i32 %conv
24}
25
26; Function Attrs: norecurse nounwind readnone
27define dso_local signext i32 @test_iltui_sext(i32 zeroext %a, i32 zeroext %b) {
28; CHECK-LABEL: test_iltui_sext:
29; CHECK:       # %bb.0: # %entry
30; CHECK-NEXT:    sub r3, r3, r4
31; CHECK-NEXT:    sradi r3, r3, 63
32; CHECK-NEXT:    blr
33entry:
34  %cmp = icmp ult i32 %a, %b
35  %sub = sext i1 %cmp to i32
36  ret i32 %sub
37}
38
39; Function Attrs: norecurse nounwind
40define dso_local void @test_iltui_store(i32 zeroext %a, i32 zeroext %b) {
41; CHECK-LABEL: test_iltui_store:
42; CHECK:       # %bb.0: # %entry
43; CHECK-NEXT:    sub r3, r3, r4
44; CHECK-NEXT:    addis r5, r2, glob@toc@ha
45; CHECK-NEXT:    rldicl r3, r3, 1, 63
46; CHECK-NEXT:    stw r3, glob@toc@l(r5)
47; CHECK-NEXT:    blr
48entry:
49  %cmp = icmp ult i32 %a, %b
50  %conv = zext i1 %cmp to i32
51  store i32 %conv, i32* @glob, align 4
52  ret void
53}
54
55; Function Attrs: norecurse nounwind
56define dso_local void @test_iltui_sext_store(i32 zeroext %a, i32 zeroext %b) {
57; CHECK-LABEL: test_iltui_sext_store:
58; CHECK:       # %bb.0: # %entry
59; CHECK-NEXT:    sub r3, r3, r4
60; CHECK-NEXT:    addis r5, r2, glob@toc@ha
61; CHECK-NEXT:    sradi r3, r3, 63
62; CHECK-NEXT:    stw r3, glob@toc@l(r5)
63; CHECK-NEXT:    blr
64entry:
65  %cmp = icmp ult i32 %a, %b
66  %sub = sext i1 %cmp to i32
67  store i32 %sub, i32* @glob, align 4
68  ret void
69}
70