1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 08:23:21 +01:00
llvm-mirror/test/Transforms/InstCombine/exact-sdiv.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

53 lines
921 B
LLVM

; RUN: opt < %s -instcombine -S | FileCheck %s
; CHECK: define i32 @foo
; CHECK: sdiv i32 %x, 8
define i32 @foo(i32 %x) {
%y = sdiv i32 %x, 8
ret i32 %y
}
; CHECK: define i32 @bar
; CHECK: ashr i32 %x, 3
define i32 @bar(i32 %x) {
%y = sdiv exact i32 %x, 8
ret i32 %y
}
; CHECK: i32 @a0
; CHECK: %y = srem i32 %x, 3
; CHECK: %z = sub i32 %x, %y
; CHECK: ret i32 %z
define i32 @a0(i32 %x) {
%y = sdiv i32 %x, 3
%z = mul i32 %y, 3
ret i32 %z
}
; CHECK: i32 @b0
; CHECK: ret i32 %x
define i32 @b0(i32 %x) {
%y = sdiv exact i32 %x, 3
%z = mul i32 %y, 3
ret i32 %z
}
; CHECK: i32 @a1
; CHECK: %y = srem i32 %x, 3
; CHECK: %z = sub i32 %y, %x
; CHECK: ret i32 %z
define i32 @a1(i32 %x) {
%y = sdiv i32 %x, 3
%z = mul i32 %y, -3
ret i32 %z
}
; CHECK: i32 @b1
; CHECK: %z = sub i32 0, %x
; CHECK: ret i32 %z
define i32 @b1(i32 %x) {
%y = sdiv exact i32 %x, 3
%z = mul i32 %y, -3
ret i32 %z
}