mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 00:32:23 +00:00
e5bd3cf000
Fixes PR13250. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164377 91177308-0d34-0410-b5e6-96231b3b80d8
38 lines
748 B
LLVM
38 lines
748 B
LLVM
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
define i32 @t1(i16 zeroext %x, i32 %y) nounwind {
|
|
entry:
|
|
; CHECK: t1
|
|
; CHECK-NOT: sdiv
|
|
; CHECK: lshr i32 %conv
|
|
%conv = zext i16 %x to i32
|
|
%s = shl i32 2, %y
|
|
%d = sdiv i32 %conv, %s
|
|
ret i32 %d
|
|
}
|
|
|
|
; rdar://11721329
|
|
define i64 @t2(i64 %x, i32 %y) nounwind {
|
|
; CHECK: t2
|
|
; CHECK-NOT: udiv
|
|
; CHECK: lshr i64 %x
|
|
%1 = shl i32 1, %y
|
|
%2 = zext i32 %1 to i64
|
|
%3 = udiv i64 %x, %2
|
|
ret i64 %3
|
|
}
|
|
|
|
; PR13250
|
|
define i64 @t3(i64 %x, i32 %y) nounwind {
|
|
; CHECK: t3
|
|
; CHECK-NOT: udiv
|
|
; CHECK-NEXT: %1 = add i32 %y, 2
|
|
; CHECK-NEXT: %2 = zext i32 %1 to i64
|
|
; CHECK-NEXT: %3 = lshr i64 %x, %2
|
|
; CHECK-NEXT: ret i64 %3
|
|
%1 = shl i32 4, %y
|
|
%2 = zext i32 %1 to i64
|
|
%3 = udiv i64 %x, %2
|
|
ret i64 %3
|
|
}
|