xref: /llvm-project/llvm/test/CodeGen/WebAssembly/simd-illegal-signext.ll (revision 41080b2fdd4b6c57d5a2926d6157b9847342b3a1)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mattr=+simd128 | FileCheck %s
3
4; Regression test for a crash caused by
5; WebAssemblyTargetLowering::ReplaceNodeResults not being
6; implemented. Since SIMD is enabled, sign_ext_inreg is custom lowered
7; but the result is i16, an illegal value. This requires
8; ReplaceNodeResults to resolve, but the default implementation is to
9; abort.
10
11target triple = "wasm32-unknown-emscripten"
12
13define void @foo() {
14; CHECK-LABEL: foo:
15; CHECK:         .functype foo () -> ()
16; CHECK-NEXT:    .local i32
17; CHECK-NEXT:  # %bb.0: # %entry
18; CHECK-NEXT:    i32.const 0
19; CHECK-NEXT:    local.get 0
20; CHECK-NEXT:    i32.load8_s 0
21; CHECK-NEXT:    i32.store16 0
22; CHECK-NEXT:    # fallthrough-return
23entry:
24  %0 = load ptr, ptr undef, align 4
25  %1 = load i32, ptr %0, align 4
26  %2 = load i32, ptr undef, align 4
27  %conv67 = trunc i32 %2 to i8
28  %conv68 = sext i8 %conv67 to i16
29  store i16 %conv68, ptr null, align 2
30  ret void
31}
32