1 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -disable-ppc-cmp-opt=0 | FileCheck %s
2 target 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"
3 target triple = "powerpc64-unknown-linux-gnu"
5 define signext i32 @foo(i32 signext %a, i32 signext %b, i32* nocapture %c) #0 {
7 %sub = sub nsw i32 %a, %b
8 store i32 %sub, i32* %c, align 4, !tbaa !0
9 %cmp = icmp sgt i32 %a, %b
10 %cond = select i1 %cmp, i32 %a, i32 %b
17 define signext i32 @foo2(i32 signext %a, i32 signext %b, i32* nocapture %c) #0 {
20 store i32 %shl, i32* %c, align 4, !tbaa !0
21 %cmp = icmp sgt i32 %shl, 0
22 %conv = zext i1 %cmp to i32
29 define i64 @fool(i64 %a, i64 %b, i64* nocapture %c) #0 {
31 %sub = sub nsw i64 %a, %b
32 store i64 %sub, i64* %c, align 8, !tbaa !3
33 %cmp = icmp sgt i64 %a, %b
34 %cond = select i1 %cmp, i64 %a, i64 %b
38 ; CHECK: subf. [[REG:[0-9]+]], 4, 3
39 ; CHECK: isel 3, 3, 4, 1
40 ; CHECK: std [[REG]], 0(5)
43 define i64 @foolb(i64 %a, i64 %b, i64* nocapture %c) #0 {
45 %sub = sub nsw i64 %a, %b
46 store i64 %sub, i64* %c, align 8, !tbaa !3
47 %cmp = icmp sle i64 %a, %b
48 %cond = select i1 %cmp, i64 %a, i64 %b
52 ; CHECK: subf. [[REG:[0-9]+]], 4, 3
53 ; CHECK: isel 3, 4, 3, 1
54 ; CHECK: std [[REG]], 0(5)
57 define i64 @foo2l(i64 %a, i64 %b, i64* nocapture %c) #0 {
60 store i64 %shl, i64* %c, align 8, !tbaa !3
61 %cmp = icmp sgt i64 %shl, 0
62 %conv1 = zext i1 %cmp to i64
70 define double @food(double %a, double %b, double* nocapture %c) #0 {
72 %sub = fsub double %a, %b
73 store double %sub, double* %c, align 8, !tbaa !3
74 %cmp = fcmp ogt double %a, %b
75 %cond = select i1 %cmp, double %a, double %b
79 ; CHECK: fsub. 0, 1, 2
83 define float @foof(float %a, float %b, float* nocapture %c) #0 {
85 %sub = fsub float %a, %b
86 store float %sub, float* %c, align 4, !tbaa !3
87 %cmp = fcmp ogt float %a, %b
88 %cond = select i1 %cmp, float %a, float %b
92 ; CHECK: fsubs. 0, 1, 2
96 !0 = metadata !{metadata !"int", metadata !1}
97 !1 = metadata !{metadata !"omnipotent char", metadata !2}
98 !2 = metadata !{metadata !"Simple C/C++ TBAA"}
99 !3 = metadata !{metadata !"long", metadata !1}
100 !4 = metadata !{metadata !"any pointer", metadata !1}