|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 |
| 2 | + |
| 3 | +; RUN: opt -passes=instsimplify -S < %s | FileCheck %s |
| 4 | + |
| 5 | +; Test that intrinsics wasm dot call are constant folded |
| 6 | + |
| 7 | +target triple = "wasm32-unknown-unknown" |
| 8 | + |
| 9 | + |
| 10 | +define <4 x i32> @dot_zero() { |
| 11 | +; CHECK-LABEL: define <4 x i32> @dot_zero() { |
| 12 | +; CHECK-NEXT: [[RES:%.*]] = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> zeroinitializer, <8 x i16> zeroinitializer) |
| 13 | +; CHECK-NEXT: ret <4 x i32> [[RES]] |
| 14 | +; |
| 15 | + %res = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> zeroinitializer, <8 x i16> zeroinitializer) |
| 16 | + ret <4 x i32> %res |
| 17 | +} |
| 18 | + |
| 19 | +define <4 x i32> @dot_nonzero() { |
| 20 | +; CHECK-LABEL: define <4 x i32> @dot_nonzero() { |
| 21 | +; CHECK-NEXT: [[RES:%.*]] = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>, <8 x i16> <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>) |
| 22 | +; CHECK-NEXT: ret <4 x i32> [[RES]] |
| 23 | +; |
| 24 | + %res = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>, <8 x i16> <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>) |
| 25 | + ret <4 x i32> %res |
| 26 | +} |
| 27 | + |
| 28 | +define <4 x i32> @dot_doubly_negative() { |
| 29 | +; CHECK-LABEL: define <4 x i32> @dot_doubly_negative() { |
| 30 | +; CHECK-NEXT: [[RES:%.*]] = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> splat (i16 -1), <8 x i16> splat (i16 -1)) |
| 31 | +; CHECK-NEXT: ret <4 x i32> [[RES]] |
| 32 | +; |
| 33 | + %res = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>, <8 x i16> <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>) |
| 34 | + ret <4 x i32> %res |
| 35 | +} |
| 36 | + |
| 37 | + |
0 commit comments