• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s
2; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-gen-isel=false < %s | FileCheck --check-prefix=CHECK-NO-ISEL %s
3target datalayout = "E-m:e-i64:64-n32:64"
4target triple = "powerpc64-unknown-linux-gnu"
5
6; Function Attrs: nounwind readnone
7define signext i32 @foo(i32 signext %a, i32 signext %b) #0 {
8entry:
9  %cmp = icmp slt i32 %a, %b
10  %conv = zext i1 %cmp to i32
11  %shl = shl nuw nsw i32 %conv, 4
12  ret i32 %shl
13
14; CHECK-LABEL: @foo
15; CHECK-NO-ISEL-LABEL: @foo
16; CHECK-DAG: cmpw
17; CHECK-DAG: li [[REG1:[0-9]+]], 0
18; CHECK-DAG: li [[REG2:[0-9]+]], 16
19; CHECK: isellt 3, [[REG2]], [[REG1]]
20; CHECK: blr
21
22; CHECK-NO-ISEL: bclr 12, 0, 0
23; CHECK-NO-ISEL: ori 3, 5, 0
24; CHECK-NO-ISEL-NEXT: blr
25}
26
27; Function Attrs: nounwind readnone
28define signext i32 @foo2(i32 signext %a, i32 signext %b) #0 {
29entry:
30  %cmp = icmp slt i32 %a, %b
31  %conv = zext i1 %cmp to i32
32  %shl = shl nuw nsw i32 %conv, 4
33  %add1 = or i32 %shl, 5
34  ret i32 %add1
35
36; CHECK-LABEL: @foo2
37; CHECK-NO-ISEL-LABEL: @foo2
38; CHECK-DAG: cmpw
39; CHECK-DAG: li [[REG1:[0-9]+]], 5
40; CHECK-DAG: li [[REG2:[0-9]+]], 21
41; CHECK: isellt 3, [[REG2]], [[REG1]]
42; CHECK: blr
43
44; CHECK-NO-ISEL: bclr 12, 0, 0
45; CHECK-NO-ISEL: ori 3, 5, 0
46; CHECK-NO-ISEL-NEXT: blr
47}
48
49; Function Attrs: nounwind readnone
50define signext i32 @foo3(i32 signext %a, i32 signext %b) #0 {
51entry:
52  %cmp = icmp sle i32 %a, %b
53  %conv = zext i1 %cmp to i32
54  %shl = shl nuw nsw i32 %conv, 4
55  ret i32 %shl
56
57; CHECK-LABEL: @foo3
58; CHECK-NO-ISEL-LABEL: @foo3
59; CHECK-DAG: cmpw
60; CHECK-DAG: li [[REG1:[0-9]+]], 16
61; CHECK: iselgt 3, 0, [[REG1]]
62; CHECK: blr
63
64; CHECK-NO-ISEL: bc 12, 1, [[TRUE:.LBB[0-9]+]]
65; CHECK-NO-ISEL: ori 3, 5, 0
66; CHECK-NO-ISEL-NEXT: blr
67; CHECK-NO-ISEL-NEXT: [[TRUE]]
68; CHECK-NO-ISEL-NEXT: li 3, 0
69; CHECK-NO-ISEL-NEXT: blr
70}
71
72attributes #0 = { nounwind readnone }
73
74