Skip to content
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
10 changes: 10 additions & 0 deletions llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,16 @@ WebAssemblyTargetLowering::getRegForInlineAsmConstraint(
if (VT.getSizeInBits() <= 64)
return std::make_pair(0U, &WebAssembly::I64RegClass);
}
if (VT.isFloatingPoint() && !VT.isVector()) {
switch (VT.getSizeInBits()) {
case 32:
return std::make_pair(0U, &WebAssembly::F32RegClass);
case 64:
return std::make_pair(0U, &WebAssembly::F64RegClass);
default:
break;
}
}
break;
default:
break;
Expand Down
26 changes: 26 additions & 0 deletions llvm/test/CodeGen/WebAssembly/inline-asm.ll
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@ entry:
ret i64 %0
}

; CHECK-LABEL: foo_float:
; CHECK-NEXT: .functype foo_float (f32) -> (f32){{$}}
; CHECK-NEXT: #APP{{$}}
; CHECK-NEXT: # 0 = aaa(0){{$}}
; CHECK-NEXT: #NO_APP{{$}}
; CHECK-NEXT: local.get $push0=, 0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define float @foo_float(float %r) {
entry:
%0 = tail call float asm sideeffect "# $0 = aaa($1)", "=r,r"(float %r) #0, !srcloc !0
ret float %0
}

; CHECK-LABEL: foo_double:
; CHECK-NEXT: .functype foo_double (f64) -> (f64){{$}}
; CHECK-NEXT: #APP{{$}}
; CHECK-NEXT: # 0 = aaa(0){{$}}
; CHECK-NEXT: #NO_APP{{$}}
; CHECK-NEXT: local.get $push0=, 0{{$}}
; CHECK-NEXT: return $pop0{{$}}
define double @foo_double(double %r) {
entry:
%0 = tail call double asm sideeffect "# $0 = aaa($1)", "=r,r"(double %r) #0, !srcloc !0
ret double %0
}

; CHECK-LABEL: X_i16:
; CHECK: foo 1{{$}}
; CHECK: local.get $push[[S0:[0-9]+]]=, 0{{$}}
Expand Down