This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGac02baab48c2: WebAssembly: Update datalayout to match fp128 ABI change (authored by dschuff).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105749/new/ https://reviews.llvm.org/D105749 Files: clang/lib/Basic/Targets/WebAssembly.h llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp llvm/test/CodeGen/WebAssembly/varargs.ll
Index: llvm/test/CodeGen/WebAssembly/varargs.ll =================================================================== --- llvm/test/CodeGen/WebAssembly/varargs.ll +++ llvm/test/CodeGen/WebAssembly/varargs.ll @@ -2,8 +2,7 @@ ; Test varargs constructs. -target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" -target triple = "wasm32-unknown-unknown" +target triple = "wasm32-unknown-emscripten" ; Test va_start. @@ -167,21 +166,19 @@ ; within a vararg buffer. ; CHECK-LABEL: call_fp128_alignment: -; CHECK: global.get $push7=, __stack_pointer -; CHECK-NEXT: i32.const $push8=, 32 -; CHECK-NEXT: i32.sub $push12=, $pop7, $pop8 -; CHECK-NEXT: local.tee $push11=, $1=, $pop12 -; CHECK-NEXT: global.set __stack_pointer, $pop11 -; CHECK-NEXT: i32.const $push0=, 24 +; CHECK: global.get $push5=, __stack_pointer +; CHECK-NEXT: i32.const $push6=, 32 +; CHECK-NEXT: i32.sub $push10=, $pop5, $pop6 +; CHECK-NEXT: local.tee $push9=, $1=, $pop10 +; CHECK-NEXT: global.set __stack_pointer, $pop9 +; CHECK-NEXT: i32.const $push0=, 16 ; CHECK-NEXT: i32.add $push1=, $1, $pop0 ; CHECK-NEXT: i64.const $push2=, -9223372036854775808 ; CHECK-NEXT: i64.store 0($pop1), $pop2 -; CHECK-NEXT: i32.const $push3=, 16 -; CHECK-NEXT: i32.add $push4=, $1, $pop3 -; CHECK-NEXT: i64.const $push5=, 1 -; CHECK-NEXT: i64.store 0($pop4), $pop5 -; CHECK-NEXT: i32.const $push6=, 7 -; CHECK-NEXT: i32.store 0($1), $pop6 +; CHECK-NEXT: i64.const $push3=, 1 +; CHECK-NEXT: i64.store 8($1), $pop3 +; CHECK-NEXT: i32.const $push4=, 7 +; CHECK-NEXT: i32.store 0($1), $pop4 ; CHECK-NEXT: call callee, $1 define void @call_fp128_alignment(i8* %p) { entry: Index: llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp =================================================================== --- llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -120,12 +120,17 @@ const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, CodeGenOpt::Level OL, bool JIT) - : LLVMTargetMachine(T, - TT.isArch64Bit() - ? "e-m:e-p:64:64-i64:64-n32:64-S128-ni:1" - : "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1", - TT, CPU, FS, Options, getEffectiveRelocModel(RM, TT), - getEffectiveCodeModel(CM, CodeModel::Large), OL), + : LLVMTargetMachine( + T, + TT.isArch64Bit() + ? (TT.isOSEmscripten() + ? "e-m:e-p:64:64-i64:64-f128:64-n32:64-S128-ni:1" + : "e-m:e-p:64:64-i64:64-n32:64-S128-ni:1") + : (TT.isOSEmscripten() + ? "e-m:e-p:32:32-i64:64-f128:64-n32:64-S128-ni:1" + : "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1"), + TT, CPU, FS, Options, getEffectiveRelocModel(RM, TT), + getEffectiveCodeModel(CM, CodeModel::Large), OL), TLOF(new WebAssemblyTargetObjectFile()) { // WebAssembly type-checks instructions, but a noreturn function with a return // type that doesn't match the context will cause a check failure. So we lower Index: clang/lib/Basic/Targets/WebAssembly.h =================================================================== --- clang/lib/Basic/Targets/WebAssembly.h +++ clang/lib/Basic/Targets/WebAssembly.h @@ -149,7 +149,10 @@ explicit WebAssembly32TargetInfo(const llvm::Triple &T, const TargetOptions &Opts) : WebAssemblyTargetInfo(T, Opts) { - resetDataLayout("e-m:e-p:32:32-i64:64-n32:64-S128-ni:1"); + if (T.isOSEmscripten()) + resetDataLayout("e-m:e-p:32:32-i64:64-f128:64-n32:64-S128-ni:1"); + else + resetDataLayout("e-m:e-p:32:32-i64:64-n32:64-S128-ni:1"); } protected: @@ -168,7 +171,10 @@ SizeType = UnsignedLong; PtrDiffType = SignedLong; IntPtrType = SignedLong; - resetDataLayout("e-m:e-p:64:64-i64:64-n32:64-S128-ni:1"); + if (T.isOSEmscripten()) + resetDataLayout("e-m:e-p:64:64-i64:64-f128:64-n32:64-S128-ni:1"); + else + resetDataLayout("e-m:e-p:64:64-i64:64-n32:64-S128-ni:1"); } protected:
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits