[llvm] 8c40e16 - [InstCombine] add tests for bitcast; NFC

Chenbing Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun May 22 23:19:13 PDT 2022


Author: Chenbing Zheng
Date: 2022-05-23T14:17:01+08:00
New Revision: 8c40e16fb4e20272808cd795ebc86125e69e0cd5

URL: https://github.com/llvm/llvm-project/commit/8c40e16fb4e20272808cd795ebc86125e69e0cd5
DIFF: https://github.com/llvm/llvm-project/commit/8c40e16fb4e20272808cd795ebc86125e69e0cd5.diff

LOG: [InstCombine] add tests for bitcast; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/bitcast.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/bitcast.ll b/llvm/test/Transforms/InstCombine/bitcast.ll
index 9289afccff311..da2ff8e3d9445 100644
--- a/llvm/test/Transforms/InstCombine/bitcast.ll
+++ b/llvm/test/Transforms/InstCombine/bitcast.ll
@@ -149,6 +149,21 @@ define <4 x float> @bitcasts_and_bitcast_to_fp(<4 x float> %a, <8 x i16> %b) {
   ret <4 x float> %bc3
 }
 
+define <4 x float> @bitcasts_or_bitcast_to_fp(<4 x float> %a, <8 x i16> %b) {
+; CHECK-LABEL: @bitcasts_or_bitcast_to_fp(
+; CHECK-NEXT:    [[BC1:%.*]] = bitcast <4 x float> [[A:%.*]] to <2 x i64>
+; CHECK-NEXT:    [[BC2:%.*]] = bitcast <8 x i16> [[B:%.*]] to <2 x i64>
+; CHECK-NEXT:    [[AND:%.*]] = or <2 x i64> [[BC1]], [[BC2]]
+; CHECK-NEXT:    [[BC3:%.*]] = bitcast <2 x i64> [[AND]] to <4 x float>
+; CHECK-NEXT:    ret <4 x float> [[BC3]]
+;
+  %bc1 = bitcast <4 x float> %a to <2 x i64>
+  %bc2 = bitcast <8 x i16> %b to <2 x i64>
+  %and = or <2 x i64> %bc1, %bc2
+  %bc3 = bitcast <2 x i64> %and to <4 x float>
+  ret <4 x float> %bc3
+}
+
 ; FIXME: Transform limited from changing vector op to integer op to avoid codegen problems.
 
 define i128 @bitcast_or_bitcast(i128 %a, <2 x i64> %b) {


        


More information about the llvm-commits mailing list