1 ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+unimplemented-simd128 | FileCheck %s
3 ; Check that store in memory with smaller lanes are loaded and stored
4 ; as expected. This is a regression test for part of bug 39275.
6 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
7 target triple = "wasm32-unknown-unknown"
9 ; CHECK-LABEL: load_ext_2xi32:
10 ; CHECK-NEXT: .functype load_ext_2xi32 (i32) -> (v128){{$}}
11 ; CHECK-NEXT: i64.load32_u $push[[L0:[0-9]+]]=, 0($0){{$}}
12 ; CHECK-NEXT: i64x2.splat $push[[L1:[0-9]+]]=, $pop[[L0]]{{$}}
13 ; CHECK-NEXT: i64.load32_u $push[[L2:[0-9]+]]=, 4($0){{$}}
14 ; CHECK-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L1]], 1, $pop[[L2]]{{$}}
15 ; CHECK-NEXT: return $pop[[R]]{{$}}
16 define <2 x i32> @load_ext_2xi32(<2 x i32>* %p) {
17 %1 = load <2 x i32>, <2 x i32>* %p, align 4
21 ; CHECK-LABEL: load_zext_2xi32:
22 ; CHECK-NEXT: .functype load_zext_2xi32 (i32) -> (v128){{$}}
23 ; CHECK-NEXT: i64.load32_u $push[[L0:[0-9]+]]=, 0($0){{$}}
24 ; CHECK-NEXT: i64x2.splat $push[[L1:[0-9]+]]=, $pop[[L0]]{{$}}
25 ; CHECK-NEXT: i64.load32_u $push[[L2:[0-9]+]]=, 4($0){{$}}
26 ; CHECK-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L1]], 1, $pop[[L2]]{{$}}
27 ; CHECK-NEXT: return $pop[[R]]{{$}}
28 define <2 x i64> @load_zext_2xi32(<2 x i32>* %p) {
29 %1 = load <2 x i32>, <2 x i32>* %p, align 4
30 %2 = zext <2 x i32> %1 to <2 x i64>
34 ; CHECK-LABEL: load_sext_2xi32:
35 ; CHECK-NEXT: .functype load_sext_2xi32 (i32) -> (v128){{$}}
36 ; CHECK-NEXT: i64.load32_s $push[[L0:[0-9]+]]=, 0($0){{$}}
37 ; CHECK-NEXT: i64x2.splat $push[[L1:[0-9]+]]=, $pop[[L0]]{{$}}
38 ; CHECK-NEXT: i64.load32_s $push[[L2:[0-9]+]]=, 4($0){{$}}
39 ; CHECK-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L1]], 1, $pop[[L2]]{{$}}
40 ; CHECK-NEXT: return $pop[[R]]{{$}}
41 define <2 x i64> @load_sext_2xi32(<2 x i32>* %p) {
42 %1 = load <2 x i32>, <2 x i32>* %p, align 4
43 %2 = sext <2 x i32> %1 to <2 x i64>
47 ; CHECK-LABEL: store_trunc_2xi32:
48 ; CHECK-NEXT: .functype store_trunc_2xi32 (i32, v128) -> (){{$}}
49 ; CHECK-NEXT: i64x2.extract_lane $push[[L0:[0-9]+]]=, $1, 1
50 ; CHECK-NEXT: i64.store32 4($0), $pop[[L0]]
51 ; CHECK-NEXT: i64x2.extract_lane $push[[L1:[0-9]+]]=, $1, 0
52 ; CHECK-NEXT: i64.store32 0($0), $pop[[L1]]
54 define void @store_trunc_2xi32(<2 x i32>* %p, <2 x i32> %x) {
55 store <2 x i32> %x, <2 x i32>* %p, align 4