1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -verify-machineinstrs -mattr=+simd128 | FileCheck %s
3
4; Regression test for an issue in which DAG combines created a constant i8x16
5; vector with lane values of 255, which was outside the -128 to 127 range
6; expected by our ISel patterns (and similar for the i16 version) and caused an
7; ISel failure. The fix was to adjust out-of-range values manually in
8; BUILD_VECTOR lowering.
9
10target triple = "wasm32-unknown-unknown"
11
12define <4 x i8> @test_i8(<4 x i8> %b) {
13; CHECK-LABEL: test_i8:
14; CHECK:         .functype test_i8 (v128) -> (v128)
15; CHECK-NEXT:  # %bb.0:
16; CHECK-NEXT:    local.get 0
17; CHECK-NEXT:    v128.const -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
18; CHECK-NEXT:    v128.xor
19; CHECK-NEXT:    v128.const 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
20; CHECK-NEXT:    v128.and
21; CHECK-NEXT:    # fallthrough-return
22  %c = and <4 x i8> %b, <i8 1, i8 1, i8 1, i8 1>
23  %d = xor <4 x i8> %c, <i8 1, i8 1, i8 1, i8 1>
24  ret <4 x i8> %d
25}
26
27define <4 x i16> @test_i16(<4 x i16> %b) {
28; CHECK-LABEL: test_i16:
29; CHECK:         .functype test_i16 (v128) -> (v128)
30; CHECK-NEXT:  # %bb.0:
31; CHECK-NEXT:    local.get 0
32; CHECK-NEXT:    v128.const -1, -1, -1, -1, 0, 0, 0, 0
33; CHECK-NEXT:    v128.xor
34; CHECK-NEXT:    v128.const 1, 1, 1, 1, 0, 0, 0, 0
35; CHECK-NEXT:    v128.and
36; CHECK-NEXT:    # fallthrough-return
37  %c = and <4 x i16> %b, <i16 1, i16 1, i16 1, i16 1>
38  %d = xor <4 x i16> %c, <i16 1, i16 1, i16 1, i16 1>
39  ret <4 x i16> %d
40}
41