xref: /llvm-project/llvm/test/CodeGen/PowerPC/fold-zero.ll (revision 8e901c255df45e38cb1d69a576804029e20868bf)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-crbits | FileCheck %s
3; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck --check-prefix=CHECK-CRB %s
4; RUN: llc -verify-machineinstrs -mattr=-isel < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck --check-prefix=CHECK-NO-ISEL %s
5target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
6target triple = "powerpc64-unknown-linux-gnu"
7
8define i32 @test1(i1 %a, i32 %c) nounwind  {
9; CHECK-LABEL: test1:
10; CHECK:       # %bb.0:
11; CHECK-NEXT:    andi. 3, 3, 1
12; CHECK-NEXT:    iseleq 3, 0, 4
13; CHECK-NEXT:    blr
14;
15; CHECK-CRB-LABEL: test1:
16; CHECK-CRB:       # %bb.0:
17; CHECK-CRB-NEXT:    andi. 3, 3, 1
18; CHECK-CRB-NEXT:    li 3, 0
19; CHECK-CRB-NEXT:    iselgt 3, 4, 3
20; CHECK-CRB-NEXT:    blr
21;
22; CHECK-NO-ISEL-LABEL: test1:
23; CHECK-NO-ISEL:       # %bb.0:
24; CHECK-NO-ISEL-NEXT:    andi. 3, 3, 1
25; CHECK-NO-ISEL-NEXT:    bc 12, 1, .LBB0_2
26; CHECK-NO-ISEL-NEXT:  # %bb.1:
27; CHECK-NO-ISEL-NEXT:    li 4, 0
28; CHECK-NO-ISEL-NEXT:  .LBB0_2:
29; CHECK-NO-ISEL-NEXT:    mr 3, 4
30; CHECK-NO-ISEL-NEXT:    blr
31  %x = select i1 %a, i32 %c, i32 0
32  ret i32 %x
33
34}
35
36define i32 @test2(i1 %a, i32 %c) nounwind  {
37; CHECK-LABEL: test2:
38; CHECK:       # %bb.0:
39; CHECK-NEXT:    andi. 3, 3, 1
40; CHECK-NEXT:    li 3, 0
41; CHECK-NEXT:    iseleq 3, 4, 3
42; CHECK-NEXT:    blr
43;
44; CHECK-CRB-LABEL: test2:
45; CHECK-CRB:       # %bb.0:
46; CHECK-CRB-NEXT:    andi. 3, 3, 1
47; CHECK-CRB-NEXT:    iselgt 3, 0, 4
48; CHECK-CRB-NEXT:    blr
49;
50; CHECK-NO-ISEL-LABEL: test2:
51; CHECK-NO-ISEL:       # %bb.0:
52; CHECK-NO-ISEL-NEXT:    andi. 3, 3, 1
53; CHECK-NO-ISEL-NEXT:    li 3, 0
54; CHECK-NO-ISEL-NEXT:    bclr 12, 1, 0
55; CHECK-NO-ISEL-NEXT:  # %bb.1:
56; CHECK-NO-ISEL-NEXT:    mr 3, 4
57; CHECK-NO-ISEL-NEXT:    blr
58  %x = select i1 %a, i32 0, i32 %c
59  ret i32 %x
60
61}
62
63