[llvm] d37db75 - [InstCombine] Add a test case for suboptimal handling of (double (bitcast (<1 x i64> (bitcast (x86_mmx)))))
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 10 18:03:41 PST 2019
Author: Craig Topper
Date: 2019-11-10T16:25:25-08:00
New Revision: d37db750c25dc3a7da66c97d973f7a64b7bf907b
URL: https://github.com/llvm/llvm-project/commit/d37db750c25dc3a7da66c97d973f7a64b7bf907b
DIFF: https://github.com/llvm/llvm-project/commit/d37db750c25dc3a7da66c97d973f7a64b7bf907b.diff
LOG: [InstCombine] Add a test case for suboptimal handling of (double (bitcast (<1 x i64> (bitcast (x86_mmx)))))
The outer bitcast gets turned into an extractelement and another
bitcast rather than combining away to a single bitcast from mmx
to double.
Added:
Modified:
llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll b/llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll
index ee77e0629f4b..486a78529c51 100644
--- a/llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll
+++ b/llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll
@@ -49,9 +49,22 @@ define x86_mmx @e(<1 x i64> %y) {
define <1 x i64> @f(x86_mmx %y) {
; CHECK-LABEL: @f(
-; CHECK-NEXT: [[C:%.*]] = bitcast x86_mmx %y to <1 x i64>
+; CHECK-NEXT: [[C:%.*]] = bitcast x86_mmx [[Y:%.*]] to <1 x i64>
; CHECK-NEXT: ret <1 x i64> [[C]]
;
%c = bitcast x86_mmx %y to <1 x i64>
ret <1 x i64> %c
}
+
+define double @g(x86_mmx %x) {
+; CHECK-LABEL: @g(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[BC:%.*]] = bitcast x86_mmx %x to <1 x double>
+; CHECK-NEXT: [[TMP0:%.*]] = extractelement <1 x double> [[BC]], i32 0
+; CHECK-NEXT: ret double [[TMP0]]
+;
+entry:
+ %0 = bitcast x86_mmx %x to <1 x i64>
+ %1 = bitcast <1 x i64> %0 to double
+ ret double %1
+}
More information about the llvm-commits
mailing list