Instcombine seems to be mis-optimizing this function:
define i32 @f(<4 x i8> %0) {
%2 = call <4 x i8> @llvm.fshr.v4i8(<4 x i8> %0, <4 x i8> zeroinitializer, <4 x i8> <i8 -12, i8 -80, i8 35, i8 1>)
%3 = bitcast <4 x i8> %2 to i32
ret i32 %3
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i8> @llvm.fshr.v4i8(<4 x i8>, <4 x i8>, <4 x i8>) #0
attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
the result is:
define i32 @f(<4 x i8> %0) {
%2 = shl <4 x i8> %0, <i8 4, i8 0, i8 5, i8 7>
%3 = bitcast <4 x i8> %2 to i32
ret i32 %3
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i8> @llvm.fshr.v4i8(<4 x i8>, <4 x i8>, <4 x i8>) #0
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i8> @llvm.fshl.v4i8(<4 x i8>, <4 x i8>, <4 x i8>) #0
attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
Alive says:
ERROR: Value mismatch
Example:
<4 x i8> %#0 = < #x00 (0), #x01 (1), #x00 (0), #x00 (0) >
Source:
<4 x i8> %#2 = < #x00 (0), #x00 (0), #x00 (0), #x00 (0) >
i32 %#3 = #x00000000 (0)
Target:
<4 x i8> %#2 = < #x00 (0), #x01 (1), #x00 (0), #x00 (0) >
i32 %#3 = #x00000100 (256)
Source value: #x00000000 (0)
Target value: #x00000100 (256)
https://alive2.llvm.org/ce/z/s4UpPe
cc @Hatsunespica
Instcombine seems to be mis-optimizing this function:
the result is:
Alive says:
https://alive2.llvm.org/ce/z/s4UpPe
cc @Hatsunespica