Skip to content
Snippets Groups Projects
Commit 36f54002 authored by Heejin Ahn's avatar Heejin Ahn
Browse files

[WebAssembly] Gate i64x2 and f64x2 on -wasm-enable-unimplemented

Summary:
i64x2 and f64x2 operations are not implemented in V8, so we normally
do not want to emit them. However, they are in the SIMD spec proposal,
so we still want to be able to test them in the toolchain. This patch
adds a flag to enable their emission.

Reviewers: aheejin, dschuff

Subscribers: sunfish, jgravelle-google, sbc100, llvm-commits

Differential Revision: https://reviews.llvm.org/D50423

Patch by Thomas Lively (tlively)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339407 91177308-0d34-0410-b5e6-96231b3b80d8
parent e598b5c8
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,12 @@ using namespace llvm; ...@@ -35,6 +35,12 @@ using namespace llvm;
#define DEBUG_TYPE "wasm-lower" #define DEBUG_TYPE "wasm-lower"
// Emit proposed instructions that may not have been implemented in engines
cl::opt<bool> EnableUnimplementedWasmSIMDInstrs(
"wasm-enable-unimplemented-simd",
cl::desc("Emit potentially-unimplemented WebAssembly SIMD instructions"),
cl::init(false));
WebAssemblyTargetLowering::WebAssemblyTargetLowering( WebAssemblyTargetLowering::WebAssemblyTargetLowering(
const TargetMachine &TM, const WebAssemblySubtarget &STI) const TargetMachine &TM, const WebAssemblySubtarget &STI)
: TargetLowering(TM), Subtarget(&STI) { : TargetLowering(TM), Subtarget(&STI) {
...@@ -59,10 +65,12 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering( ...@@ -59,10 +65,12 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
addRegisterClass(MVT::v16i8, &WebAssembly::V128RegClass); addRegisterClass(MVT::v16i8, &WebAssembly::V128RegClass);
addRegisterClass(MVT::v8i16, &WebAssembly::V128RegClass); addRegisterClass(MVT::v8i16, &WebAssembly::V128RegClass);
addRegisterClass(MVT::v4i32, &WebAssembly::V128RegClass); addRegisterClass(MVT::v4i32, &WebAssembly::V128RegClass);
addRegisterClass(MVT::v2i64, &WebAssembly::V128RegClass);
addRegisterClass(MVT::v4f32, &WebAssembly::V128RegClass); addRegisterClass(MVT::v4f32, &WebAssembly::V128RegClass);
if (EnableUnimplementedWasmSIMDInstrs) {
addRegisterClass(MVT::v2i64, &WebAssembly::V128RegClass);
addRegisterClass(MVT::v2f64, &WebAssembly::V128RegClass); addRegisterClass(MVT::v2f64, &WebAssembly::V128RegClass);
} }
}
// Compute derived properties from the register classes. // Compute derived properties from the register classes.
computeRegisterProperties(Subtarget->getRegisterInfo()); computeRegisterProperties(Subtarget->getRegisterInfo());
......
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -wasm-enable-unimplemented-simd -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -wasm-enable-unimplemented-simd -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128-VM
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128-VM
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=-simd128 | FileCheck %s --check-prefixes CHECK,NO-SIMD128 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=-simd128 | FileCheck %s --check-prefixes CHECK,NO-SIMD128
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=-simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,NO-SIMD128 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -mattr=-simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,NO-SIMD128
...@@ -121,6 +123,7 @@ define <4 x i32> @mul_v4i32(<4 x i32> %x, <4 x i32> %y) { ...@@ -121,6 +123,7 @@ define <4 x i32> @mul_v4i32(<4 x i32> %x, <4 x i32> %y) {
; ============================================================================== ; ==============================================================================
; CHECK-LABEL: add_v2i64 ; CHECK-LABEL: add_v2i64
; NO-SIMD128-NOT: i64x2 ; NO-SIMD128-NOT: i64x2
; SIMD128-VM-NOT: i64x2
; SIMD128: .param v128, v128{{$}} ; SIMD128: .param v128, v128{{$}}
; SIMD128: .result v128{{$}} ; SIMD128: .result v128{{$}}
; SIMD128: i64x2.add $push0=, $0, $1{{$}} ; SIMD128: i64x2.add $push0=, $0, $1{{$}}
...@@ -132,6 +135,7 @@ define <2 x i64> @add_v2i64(<2 x i64> %x, <2 x i64> %y) { ...@@ -132,6 +135,7 @@ define <2 x i64> @add_v2i64(<2 x i64> %x, <2 x i64> %y) {
; CHECK-LABEL: sub_v2i64 ; CHECK-LABEL: sub_v2i64
; NO-SIMD128-NOT: i64x2 ; NO-SIMD128-NOT: i64x2
; SIMD128-VM-NOT: i64x2
; SIMD128: .param v128, v128{{$}} ; SIMD128: .param v128, v128{{$}}
; SIMD128: .result v128{{$}} ; SIMD128: .result v128{{$}}
; SIMD128: i64x2.sub $push0=, $0, $1{{$}} ; SIMD128: i64x2.sub $push0=, $0, $1{{$}}
...@@ -143,6 +147,7 @@ define <2 x i64> @sub_v2i64(<2 x i64> %x, <2 x i64> %y) { ...@@ -143,6 +147,7 @@ define <2 x i64> @sub_v2i64(<2 x i64> %x, <2 x i64> %y) {
; CHECK-LABEL: mul_v2i64 ; CHECK-LABEL: mul_v2i64
; NO-SIMD128-NOT: i64x2 ; NO-SIMD128-NOT: i64x2
; SIMD128-VM-NOT: i64x2
; SIMD128: .param v128, v128{{$}} ; SIMD128: .param v128, v128{{$}}
; SIMD128: .result v128{{$}} ; SIMD128: .result v128{{$}}
; SIMD128: i64x2.mul $push0=, $0, $1{{$}} ; SIMD128: i64x2.mul $push0=, $0, $1{{$}}
...@@ -204,6 +209,7 @@ define <4 x float> @mul_v4f32(<4 x float> %x, <4 x float> %y) { ...@@ -204,6 +209,7 @@ define <4 x float> @mul_v4f32(<4 x float> %x, <4 x float> %y) {
; ============================================================================== ; ==============================================================================
; CHECK-LABEL: add_v2f64 ; CHECK-LABEL: add_v2f64
; NO-SIMD128-NOT: f64x2 ; NO-SIMD128-NOT: f64x2
; SIMD129-VM-NOT: f62x2
; SIMD128: .param v128, v128{{$}} ; SIMD128: .param v128, v128{{$}}
; SIMD128: .result v128{{$}} ; SIMD128: .result v128{{$}}
; SIMD128: f64x2.add $push0=, $0, $1{{$}} ; SIMD128: f64x2.add $push0=, $0, $1{{$}}
...@@ -215,6 +221,7 @@ define <2 x double> @add_v2f64(<2 x double> %x, <2 x double> %y) { ...@@ -215,6 +221,7 @@ define <2 x double> @add_v2f64(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: sub_v2f64 ; CHECK-LABEL: sub_v2f64
; NO-SIMD128-NOT: f64x2 ; NO-SIMD128-NOT: f64x2
; SIMD129-VM-NOT: f62x2
; SIMD128: .param v128, v128{{$}} ; SIMD128: .param v128, v128{{$}}
; SIMD128: .result v128{{$}} ; SIMD128: .result v128{{$}}
; SIMD128: f64x2.sub $push0=, $0, $1{{$}} ; SIMD128: f64x2.sub $push0=, $0, $1{{$}}
...@@ -226,6 +233,7 @@ define <2 x double> @sub_v2f64(<2 x double> %x, <2 x double> %y) { ...@@ -226,6 +233,7 @@ define <2 x double> @sub_v2f64(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: div_v2f64 ; CHECK-LABEL: div_v2f64
; NO-SIMD128-NOT: f64x2 ; NO-SIMD128-NOT: f64x2
; SIMD129-VM-NOT: f62x2
; SIMD128: .param v128, v128{{$}} ; SIMD128: .param v128, v128{{$}}
; SIMD128: .result v128{{$}} ; SIMD128: .result v128{{$}}
; SIMD128: f64x2.div $push0=, $0, $1{{$}} ; SIMD128: f64x2.div $push0=, $0, $1{{$}}
...@@ -237,6 +245,7 @@ define <2 x double> @div_v2f64(<2 x double> %x, <2 x double> %y) { ...@@ -237,6 +245,7 @@ define <2 x double> @div_v2f64(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: mul_v2f64 ; CHECK-LABEL: mul_v2f64
; NO-SIMD128-NOT: f64x2 ; NO-SIMD128-NOT: f64x2
; SIMD129-VM-NOT: f62x2
; SIMD128: .param v128, v128{{$}} ; SIMD128: .param v128, v128{{$}}
; SIMD128: .result v128{{$}} ; SIMD128: .result v128{{$}}
; SIMD128: f64x2.mul $push0=, $0, $1{{$}} ; SIMD128: f64x2.mul $push0=, $0, $1{{$}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment