Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebAssembly] Enable simd128 when relaxed-simd is set in AsmPrinter #99803

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def HasSignExt :

def HasSIMD128 :
Predicate<"Subtarget->hasSIMD128()">,
AssemblerPredicate<(all_of FeatureSIMD128), "simd128">;
AssemblerPredicate<(any_of FeatureSIMD128, FeatureRelaxedSIMD), "simd128">;

def HasTailCall :
Predicate<"Subtarget->hasTailCall()">,
Expand Down
24 changes: 24 additions & 0 deletions llvm/test/CodeGen/WebAssembly/simd-asm-pred.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
; RUN: llc < %s -verify-machineinstrs -mattr=+relaxed-simd | FileCheck %s

; Test that setting "relaxed-simd" target feature set also implies 'simd128' in
; AssemblerPredicate, which is used to verify instructions in AsmPrinter.

target triple = "wasm32-unknown-unknown"

declare <2 x i64> @llvm.wasm.relaxed.laneselect.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)

; The compiled result of this function uses LOCAL_GET_V128, which is predicated
; on the 'simd128' feature. We should be able to compile this when only
; 'relaxed-simd' is set, which implies 'simd128'.
define <2 x i64> @test(<2 x i64>, <2 x i64>, <2 x i64>) #0 {
; CHECK-LABEL: test:
; CHECK: .functype test (v128, v128, v128) -> (v128)
; CHECK-NEXT: # %bb.0:
; CHECK-NEXT: local.get 0
; CHECK-NEXT: local.get 1
; CHECK-NEXT: local.get 2
; CHECK-NEXT: i64x2.relaxed_laneselect
start:
%_4 = tail call <2 x i64> @llvm.wasm.relaxed.laneselect.v2i64(<2 x i64> %0, <2 x i64> %1, <2 x i64> %2) #3
ret <2 x i64> %_4
}
Loading