[WebAssembly] Fix legalization of f32->f64 EXTLOAD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255202 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2015-12-10 02:07:53 +00:00
parent b4fe333388
commit b2d324bc23
2 changed files with 21 additions and 1 deletions

View File

@ -179,7 +179,7 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
// - Floating-point extending loads.
// - Floating-point truncating stores.
// - i1 extending loads.
setLoadExtAction(ISD::EXTLOAD, MVT::f32, MVT::f64, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f32, Expand);
setTruncStoreAction(MVT::f64, MVT::f32, Expand);
for (auto T : MVT::integer_valuetypes())
for (auto Ext : {ISD::EXTLOAD, ISD::ZEXTLOAD, ISD::SEXTLOAD})

View File

@ -31,3 +31,23 @@ define i64 @sext_in_reg_i32_i64(i64 %a) {
%c = ashr i64 %b, 32
ret i64 %c
}
; CHECK-LABEL: fpext_f32_f64:
; CHECK: f32.load $push0=, 0($0){{$}}
; CHECK: f64.promote/f32 $push1=, $pop0
; CHECK: return $pop1{{$}}
define double @fpext_f32_f64(float *%p) {
%v = load float, float* %p
%e = fpext float %v to double
ret double %e
}
; CHECK-LABEL: fpconv_f64_f32:
; CHECK: f64.load $push0=, 0($0){{$}}
; CHECK: f32.demote/f64 $push1=, $pop0
; CHECK: return $pop1{{$}}
define float @fpconv_f64_f32(double *%p) {
%v = load double, double* %p
%e = fptrunc double %v to float
ret float %e
}