https://bugs.llvm.org/show_bug.cgi?id=50172
Bug ID: 50172
Summary: Missing fold cttz(zext(x)) -> zext(cttz(x))
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
define i32 @src(i16 %x) {
%z = zext i16 %x to i32
%p = call i32 @llvm.cttz.i32(i32 %z, i1 true)
ret i32 %p
}
define i32 @tgt(i16 %x) {
%p = call i16 @llvm.cttz.i16(i16 %x, i1 true)
%z = zext i16 %p to i32
ret i32 %z
}
declare i32 @llvm.cttz.i32(i32, i1)
declare i16 @llvm.cttz.i16(i16, i1)
----------------------------------------
define i32 @src(i16 %x) {
%0:
%z = zext i16 %x to i32
%p = cttz i32 %z, 1
ret i32 %p
}
=>
define i32 @tgt(i16 %x) {
%0:
%p = cttz i16 %x, 0
%z = zext i16 %p to i32
ret i32 %z
}
Transformation seems to be correct!
src: # @src
movzx eax, di
bsf eax, eax
ret
tgt: # @tgt
bsf ax, di
movzx eax, ax
ret
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs