[InstCombine] Add test cases to show bad canonicalization of bitcasts between x86_mmx and <1 x i64>.
As the test cases show, we end up with an insert/extract and a bitcast to/from i64. x86_mmx is for some purposes conceptually a vector. We shouldn't be adding scalar conversions around it. Since _m64 is defined as <1 x i64> and intrinsics use x86_mmx as their input/output these extra scalar operations prevent the X86 backend from generating good code especially on 32-bit targets where i64 gets split.
This commit is contained in:
parent
2b943c4687
commit
96119586c9
|
@ -38,3 +38,22 @@ define <1 x i64> @d(i64 %y) {
|
|||
ret <1 x i64> %c
|
||||
}
|
||||
|
||||
define x86_mmx @e(<1 x i64> %y) {
|
||||
; CHECK-LABEL: @e(
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x i64> %y, i32 0
|
||||
; CHECK-NEXT: [[C:%.*]] = bitcast i64 [[TMP1]] to x86_mmx
|
||||
; CHECK-NEXT: ret x86_mmx [[C]]
|
||||
;
|
||||
%c = bitcast <1 x i64> %y to x86_mmx
|
||||
ret x86_mmx %c
|
||||
}
|
||||
|
||||
define <1 x i64> @f(x86_mmx %y) {
|
||||
; CHECK-LABEL: @f(
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = bitcast x86_mmx %y to i64
|
||||
; CHECK-NEXT: [[C:%.*]] = insertelement <1 x i64> undef, i64 [[TMP1]], i32 0
|
||||
; CHECK-NEXT: ret <1 x i64> [[C]]
|
||||
;
|
||||
%c = bitcast x86_mmx %y to <1 x i64>
|
||||
ret <1 x i64> %c
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue