1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 16:33:37 +01:00
llvm-mirror/test/Transforms/InstCombine/adjust-for-sminmax.ll
Dan Gohman 205b641954 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename.

llvm-svn: 81537
2009-09-11 18:01:28 +00:00

86 lines
1.8 KiB
LLVM

; RUN: opt < %s -instcombine -S | grep {icmp s\[lg\]t i32 %n, 0} | count 16
; Instcombine should recognize that this code can be adjusted
; to fit the canonical smax/smin pattern.
define i32 @floor_a(i32 %n) {
%t = icmp sgt i32 %n, -1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_a(i32 %n) {
%t = icmp slt i32 %n, 1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @floor_b(i32 %n) {
%t = icmp sgt i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_b(i32 %n) {
%t = icmp slt i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @floor_c(i32 %n) {
%t = icmp sge i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_c(i32 %n) {
%t = icmp sle i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @floor_d(i32 %n) {
%t = icmp sge i32 %n, 1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_d(i32 %n) {
%t = icmp sle i32 %n, -1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @floor_e(i32 %n) {
%t = icmp sgt i32 %n, -1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_e(i32 %n) {
%t = icmp slt i32 %n, 1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @floor_f(i32 %n) {
%t = icmp sgt i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_f(i32 %n) {
%t = icmp slt i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @floor_g(i32 %n) {
%t = icmp sge i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_g(i32 %n) {
%t = icmp sle i32 %n, 0
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @floor_h(i32 %n) {
%t = icmp sge i32 %n, 1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}
define i32 @ceil_h(i32 %n) {
%t = icmp sle i32 %n, -1
%m = select i1 %t, i32 %n, i32 0
ret i32 %m
}