mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
X86: Generalize the x << (y & const) optimization to also catch masks with more set bits set than 31 or 63.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148024 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
; RUN: llc < %s -march=x86 | grep and | count 1
|
||||
; RUN: llc < %s -march=x86 | grep and | count 2
|
||||
; RUN: llc < %s -march=x86-64 | not grep and
|
||||
|
||||
define i32 @t1(i32 %t, i32 %val) nounwind {
|
||||
@@ -7,9 +7,15 @@ define i32 @t1(i32 %t, i32 %val) nounwind {
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
define i32 @t2(i32 %t, i32 %val) nounwind {
|
||||
%shamt = and i32 %t, 63
|
||||
%res = shl i32 %val, %shamt
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
@X = internal global i16 0
|
||||
|
||||
define void @t2(i16 %t) nounwind {
|
||||
define void @t3(i16 %t) nounwind {
|
||||
%shamt = and i16 %t, 31
|
||||
%tmp = load i16* @X
|
||||
%tmp1 = ashr i16 %tmp, %shamt
|
||||
@@ -17,8 +23,14 @@ define void @t2(i16 %t) nounwind {
|
||||
ret void
|
||||
}
|
||||
|
||||
define i64 @t3(i64 %t, i64 %val) nounwind {
|
||||
define i64 @t4(i64 %t, i64 %val) nounwind {
|
||||
%shamt = and i64 %t, 63
|
||||
%res = lshr i64 %val, %shamt
|
||||
ret i64 %res
|
||||
}
|
||||
|
||||
define i64 @t5(i64 %t, i64 %val) nounwind {
|
||||
%shamt = and i64 %t, 191
|
||||
%res = lshr i64 %val, %shamt
|
||||
ret i64 %res
|
||||
}
|
||||
|
Reference in New Issue
Block a user