1; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 | FileCheck %s 2 3; Test that a splat shuffle of an fp-to-int bitcasted vector correctly 4; optimizes and lowers to a single splat instruction. Without a custom 5; DAG combine, this ends up doing both a splat and a shuffle. 6 7target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" 8target triple = "wasm32-unknown-unknown" 9 10; CHECK-LABEL: f32x4_splat: 11; CHECK-NEXT: .functype f32x4_splat (f32) -> (v128){{$}} 12; CHECK-NEXT: f32x4.splat $push[[R:[0-9]+]]=, $0{{$}} 13; CHECK-NEXT: return $pop[[R]]{{$}} 14define <4 x i32> @f32x4_splat(float %x) { 15 %vecinit = insertelement <4 x float> undef, float %x, i32 0 16 %a = bitcast <4 x float> %vecinit to <4 x i32> 17 %b = shufflevector <4 x i32> %a, <4 x i32> undef, <4 x i32> zeroinitializer 18 ret <4 x i32> %b 19} 20 21; CHECK-LABEL: not_a_vec: 22; CHECK-NEXT: .functype not_a_vec (i64, i64) -> (v128){{$}} 23; CHECK-NEXT: i64x2.splat $push[[L1:[0-9]+]]=, $0{{$}} 24; CHECK-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $pop[[L1]], $2, 0, 1, 2, 3 25; CHECK-NEXT: return $pop[[R]] 26define <4 x i32> @not_a_vec(i128 %x) { 27 %a = bitcast i128 %x to <4 x i32> 28 %b = shufflevector <4 x i32> %a, <4 x i32> undef, <4 x i32> zeroinitializer 29 ret <4 x i32> %b 30} 31