mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-10 06:54:54 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
86 lines
1.8 KiB
LLVM
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
|
|
}
|