From f63a805a4e9924002a9533b335ab29a8b5c7a9ac Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Sat, 15 Jan 2022 10:04:25 +0800 Subject: [PATCH] Revert "[X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC" This reverts commit 1bb0caf561688681be67cc91560348c9e43fcbf3. --- clang/lib/Basic/Targets/X86.h | 11 +- clang/test/CodeGen/target-data.c | 2 +- llvm/lib/IR/AutoUpgrade.cpp | 19 +- llvm/lib/Target/X86/X86TargetMachine.cpp | 2 +- llvm/test/Bitcode/upgrade-datalayout3.ll | 2 +- llvm/test/CodeGen/X86/long-double-abi-align.ll | 4 +- llvm/test/CodeGen/X86/scalar-fp-to-i32.ll | 219 +++++++---------------- llvm/test/CodeGen/X86/scalar-fp-to-i64.ll | 32 ++-- llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp | 2 +- 9 files changed, 99 insertions(+), 194 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index d1b6643..c952b8c 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -533,12 +533,11 @@ public: DoubleAlign = LongLongAlign = 64; bool IsWinCOFF = getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF(); - bool IsMSVC = getTriple().isWindowsMSVCEnvironment(); - std::string Layout = IsWinCOFF ? "e-m:x" : "e-m:e"; - Layout += "-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-"; - Layout += IsMSVC ? "f80:128" : "f80:32"; - Layout += "-n8:16:32-a:0:32-S32"; - resetDataLayout(Layout, IsWinCOFF ? "_" : ""); + resetDataLayout(IsWinCOFF ? "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:32-n8:16:32-a:0:32-S32" + : "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:32-n8:16:32-a:0:32-S32", + IsWinCOFF ? "_" : ""); } }; diff --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c index e415083..d702f84 100644 --- a/clang/test/CodeGen/target-data.c +++ b/clang/test/CodeGen/target-data.c @@ -8,7 +8,7 @@ // RUN: %clang_cc1 -triple i686-unknown-win32 -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=I686-WIN32 %s -// I686-WIN32: target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32" +// I686-WIN32: target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32" // RUN: %clang_cc1 -triple i686-unknown-cygwin -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=I686-CYGWIN %s diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 9b9325a..a7c34ca 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -4569,29 +4569,18 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) { return DL.empty() ? std::string("G1") : (DL + "-G1").str(); } - std::string Res = DL.str(); std::string AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64"; // If X86, and the datalayout matches the expected format, add pointer size // address spaces to the datalayout. if (!T.isX86() || DL.contains(AddrSpaces)) - return Res; + return std::string(DL); SmallVector Groups; Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)"); - if (R.match(DL, &Groups)) - Res = (Groups[1] + AddrSpaces + Groups[3]).str(); - - // For 32-bit MSVC targets, raise the alignment of f80 values to 16 bytes. - // Raising the alignment is safe because Clang did not produce f80 values in - // the MSVC environment before this upgrade was added. - if (T.isWindowsMSVCEnvironment() && !T.isArch64Bit()) { - StringRef Ref = Res; - auto I = Ref.find("-f80:32-"); - if (I != StringRef::npos) - Res = (Ref.take_front(I) + "-f80:128-" + Ref.drop_front(I + 8)).str(); - } + if (!R.match(DL, &Groups)) + return std::string(DL); - return Res; + return (Groups[1] + AddrSpaces + Groups[3]).str(); } void llvm::UpgradeAttributes(AttrBuilder &B) { diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp index e3d0128..78bc551 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.cpp +++ b/llvm/lib/Target/X86/X86TargetMachine.cpp @@ -127,7 +127,7 @@ static std::string computeDataLayout(const Triple &TT) { // Some ABIs align long double to 128 bits, others to 32. if (TT.isOSNaCl() || TT.isOSIAMCU()) ; // No f80 - else if (TT.isArch64Bit() || TT.isOSDarwin() || TT.isWindowsMSVCEnvironment()) + else if (TT.isArch64Bit() || TT.isOSDarwin()) Ret += "-f80:128"; else Ret += "-f80:32"; diff --git a/llvm/test/Bitcode/upgrade-datalayout3.ll b/llvm/test/Bitcode/upgrade-datalayout3.ll index 6d95f24..526ba60 100644 --- a/llvm/test/Bitcode/upgrade-datalayout3.ll +++ b/llvm/test/Bitcode/upgrade-datalayout3.ll @@ -5,4 +5,4 @@ target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32" target triple = "i686-pc-windows-msvc" -; CHECK: target datalayout = "e-m:w-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-S32" +; CHECK: target datalayout = "e-m:w-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-S32" diff --git a/llvm/test/CodeGen/X86/long-double-abi-align.ll b/llvm/test/CodeGen/X86/long-double-abi-align.ll index 6a409f1..ca45886 100644 --- a/llvm/test/CodeGen/X86/long-double-abi-align.ll +++ b/llvm/test/CodeGen/X86/long-double-abi-align.ll @@ -11,7 +11,7 @@ define void @foo(i32 %0, x86_fp80 %1, i32 %2) nounwind { ; MSVC-NEXT: movl %esp, %ebp ; MSVC-NEXT: andl $-16, %esp ; MSVC-NEXT: subl $32, %esp -; MSVC-NEXT: fldt 24(%ebp) +; MSVC-NEXT: fldt 12(%ebp) ; MSVC-NEXT: fstpt (%esp) ; MSVC-NEXT: leal 8(%ebp), %eax ; MSVC-NEXT: pushl %eax @@ -21,7 +21,7 @@ define void @foo(i32 %0, x86_fp80 %1, i32 %2) nounwind { ; MSVC-NEXT: pushl %eax ; MSVC-NEXT: calll _escape ; MSVC-NEXT: addl $4, %esp -; MSVC-NEXT: leal 40(%ebp), %eax +; MSVC-NEXT: leal 24(%ebp), %eax ; MSVC-NEXT: pushl %eax ; MSVC-NEXT: calll _escape ; MSVC-NEXT: addl $4, %esp diff --git a/llvm/test/CodeGen/X86/scalar-fp-to-i32.ll b/llvm/test/CodeGen/X86/scalar-fp-to-i32.ll index b22533a..469c05d 100644 --- a/llvm/test/CodeGen/X86/scalar-fp-to-i32.ll +++ b/llvm/test/CodeGen/X86/scalar-fp-to-i32.ll @@ -344,8 +344,8 @@ define i32 @x_to_u32(x86_fp80 %a) nounwind { ; X86-AVX512-WIN: # %bb.0: ; X86-AVX512-WIN-NEXT: pushl %ebp ; X86-AVX512-WIN-NEXT: movl %esp, %ebp -; X86-AVX512-WIN-NEXT: andl $-16, %esp -; X86-AVX512-WIN-NEXT: subl $16, %esp +; X86-AVX512-WIN-NEXT: andl $-8, %esp +; X86-AVX512-WIN-NEXT: subl $8, %esp ; X86-AVX512-WIN-NEXT: fldt 8(%ebp) ; X86-AVX512-WIN-NEXT: fisttpll (%esp) ; X86-AVX512-WIN-NEXT: movl (%esp), %eax @@ -382,8 +382,8 @@ define i32 @x_to_u32(x86_fp80 %a) nounwind { ; X86-SSE3-WIN: # %bb.0: ; X86-SSE3-WIN-NEXT: pushl %ebp ; X86-SSE3-WIN-NEXT: movl %esp, %ebp -; X86-SSE3-WIN-NEXT: andl $-16, %esp -; X86-SSE3-WIN-NEXT: subl $16, %esp +; X86-SSE3-WIN-NEXT: andl $-8, %esp +; X86-SSE3-WIN-NEXT: subl $8, %esp ; X86-SSE3-WIN-NEXT: fldt 8(%ebp) ; X86-SSE3-WIN-NEXT: fisttpll (%esp) ; X86-SSE3-WIN-NEXT: movl (%esp), %eax @@ -420,8 +420,8 @@ define i32 @x_to_u32(x86_fp80 %a) nounwind { ; X86-SSE2-WIN: # %bb.0: ; X86-SSE2-WIN-NEXT: pushl %ebp ; X86-SSE2-WIN-NEXT: movl %esp, %ebp -; X86-SSE2-WIN-NEXT: andl $-16, %esp -; X86-SSE2-WIN-NEXT: subl $32, %esp +; X86-SSE2-WIN-NEXT: andl $-8, %esp +; X86-SSE2-WIN-NEXT: subl $16, %esp ; X86-SSE2-WIN-NEXT: fldt 8(%ebp) ; X86-SSE2-WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; X86-SSE2-WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax @@ -482,8 +482,8 @@ define i32 @x_to_u32(x86_fp80 %a) nounwind { ; X86-SSE1-WIN: # %bb.0: ; X86-SSE1-WIN-NEXT: pushl %ebp ; X86-SSE1-WIN-NEXT: movl %esp, %ebp -; X86-SSE1-WIN-NEXT: andl $-16, %esp -; X86-SSE1-WIN-NEXT: subl $32, %esp +; X86-SSE1-WIN-NEXT: andl $-8, %esp +; X86-SSE1-WIN-NEXT: subl $16, %esp ; X86-SSE1-WIN-NEXT: fldt 8(%ebp) ; X86-SSE1-WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; X86-SSE1-WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax @@ -516,8 +516,8 @@ define i32 @x_to_u32(x86_fp80 %a) nounwind { ; X87-WIN: # %bb.0: ; X87-WIN-NEXT: pushl %ebp ; X87-WIN-NEXT: movl %esp, %ebp -; X87-WIN-NEXT: andl $-16, %esp -; X87-WIN-NEXT: subl $32, %esp +; X87-WIN-NEXT: andl $-8, %esp +; X87-WIN-NEXT: subl $16, %esp ; X87-WIN-NEXT: fldt 8(%ebp) ; X87-WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; X87-WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax @@ -550,27 +550,14 @@ define i32 @x_to_u32(x86_fp80 %a) nounwind { } define i32 @x_to_s32(x86_fp80 %a) nounwind { -; X86-AVX512-WIN-LABEL: x_to_s32: -; X86-AVX512-WIN: # %bb.0: -; X86-AVX512-WIN-NEXT: pushl %ebp -; X86-AVX512-WIN-NEXT: movl %esp, %ebp -; X86-AVX512-WIN-NEXT: andl $-16, %esp -; X86-AVX512-WIN-NEXT: subl $16, %esp -; X86-AVX512-WIN-NEXT: fldt 8(%ebp) -; X86-AVX512-WIN-NEXT: fisttpl {{[0-9]+}}(%esp) -; X86-AVX512-WIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-AVX512-WIN-NEXT: movl %ebp, %esp -; X86-AVX512-WIN-NEXT: popl %ebp -; X86-AVX512-WIN-NEXT: retl -; -; X86-AVX512-LIN-LABEL: x_to_s32: -; X86-AVX512-LIN: # %bb.0: -; X86-AVX512-LIN-NEXT: pushl %eax -; X86-AVX512-LIN-NEXT: fldt {{[0-9]+}}(%esp) -; X86-AVX512-LIN-NEXT: fisttpl (%esp) -; X86-AVX512-LIN-NEXT: movl (%esp), %eax -; X86-AVX512-LIN-NEXT: popl %ecx -; X86-AVX512-LIN-NEXT: retl +; X86-AVX512-LABEL: x_to_s32: +; X86-AVX512: # %bb.0: +; X86-AVX512-NEXT: pushl %eax +; X86-AVX512-NEXT: fldt {{[0-9]+}}(%esp) +; X86-AVX512-NEXT: fisttpl (%esp) +; X86-AVX512-NEXT: movl (%esp), %eax +; X86-AVX512-NEXT: popl %ecx +; X86-AVX512-NEXT: retl ; ; X64-AVX512-WIN-LABEL: x_to_s32: ; X64-AVX512-WIN: # %bb.0: @@ -588,27 +575,14 @@ define i32 @x_to_s32(x86_fp80 %a) nounwind { ; X64-AVX512-LIN-NEXT: movl -{{[0-9]+}}(%rsp), %eax ; X64-AVX512-LIN-NEXT: retq ; -; X86-SSE3-WIN-LABEL: x_to_s32: -; X86-SSE3-WIN: # %bb.0: -; X86-SSE3-WIN-NEXT: pushl %ebp -; X86-SSE3-WIN-NEXT: movl %esp, %ebp -; X86-SSE3-WIN-NEXT: andl $-16, %esp -; X86-SSE3-WIN-NEXT: subl $16, %esp -; X86-SSE3-WIN-NEXT: fldt 8(%ebp) -; X86-SSE3-WIN-NEXT: fisttpl {{[0-9]+}}(%esp) -; X86-SSE3-WIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE3-WIN-NEXT: movl %ebp, %esp -; X86-SSE3-WIN-NEXT: popl %ebp -; X86-SSE3-WIN-NEXT: retl -; -; X86-SSE3-LIN-LABEL: x_to_s32: -; X86-SSE3-LIN: # %bb.0: -; X86-SSE3-LIN-NEXT: pushl %eax -; X86-SSE3-LIN-NEXT: fldt {{[0-9]+}}(%esp) -; X86-SSE3-LIN-NEXT: fisttpl (%esp) -; X86-SSE3-LIN-NEXT: movl (%esp), %eax -; X86-SSE3-LIN-NEXT: popl %ecx -; X86-SSE3-LIN-NEXT: retl +; X86-SSE3-LABEL: x_to_s32: +; X86-SSE3: # %bb.0: +; X86-SSE3-NEXT: pushl %eax +; X86-SSE3-NEXT: fldt {{[0-9]+}}(%esp) +; X86-SSE3-NEXT: fisttpl (%esp) +; X86-SSE3-NEXT: movl (%esp), %eax +; X86-SSE3-NEXT: popl %ecx +; X86-SSE3-NEXT: retl ; ; X64-SSE3-WIN-LABEL: x_to_s32: ; X64-SSE3-WIN: # %bb.0: @@ -626,39 +600,20 @@ define i32 @x_to_s32(x86_fp80 %a) nounwind { ; X64-SSE3-LIN-NEXT: movl -{{[0-9]+}}(%rsp), %eax ; X64-SSE3-LIN-NEXT: retq ; -; X86-SSE2-WIN-LABEL: x_to_s32: -; X86-SSE2-WIN: # %bb.0: -; X86-SSE2-WIN-NEXT: pushl %ebp -; X86-SSE2-WIN-NEXT: movl %esp, %ebp -; X86-SSE2-WIN-NEXT: andl $-16, %esp -; X86-SSE2-WIN-NEXT: subl $16, %esp -; X86-SSE2-WIN-NEXT: fldt 8(%ebp) -; X86-SSE2-WIN-NEXT: fnstcw (%esp) -; X86-SSE2-WIN-NEXT: movzwl (%esp), %eax -; X86-SSE2-WIN-NEXT: orl $3072, %eax # imm = 0xC00 -; X86-SSE2-WIN-NEXT: movw %ax, {{[0-9]+}}(%esp) -; X86-SSE2-WIN-NEXT: fldcw {{[0-9]+}}(%esp) -; X86-SSE2-WIN-NEXT: fistpl {{[0-9]+}}(%esp) -; X86-SSE2-WIN-NEXT: fldcw (%esp) -; X86-SSE2-WIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE2-WIN-NEXT: movl %ebp, %esp -; X86-SSE2-WIN-NEXT: popl %ebp -; X86-SSE2-WIN-NEXT: retl -; -; X86-SSE2-LIN-LABEL: x_to_s32: -; X86-SSE2-LIN: # %bb.0: -; X86-SSE2-LIN-NEXT: subl $8, %esp -; X86-SSE2-LIN-NEXT: fldt {{[0-9]+}}(%esp) -; X86-SSE2-LIN-NEXT: fnstcw (%esp) -; X86-SSE2-LIN-NEXT: movzwl (%esp), %eax -; X86-SSE2-LIN-NEXT: orl $3072, %eax # imm = 0xC00 -; X86-SSE2-LIN-NEXT: movw %ax, {{[0-9]+}}(%esp) -; X86-SSE2-LIN-NEXT: fldcw {{[0-9]+}}(%esp) -; X86-SSE2-LIN-NEXT: fistpl {{[0-9]+}}(%esp) -; X86-SSE2-LIN-NEXT: fldcw (%esp) -; X86-SSE2-LIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE2-LIN-NEXT: addl $8, %esp -; X86-SSE2-LIN-NEXT: retl +; X86-SSE2-LABEL: x_to_s32: +; X86-SSE2: # %bb.0: +; X86-SSE2-NEXT: subl $8, %esp +; X86-SSE2-NEXT: fldt {{[0-9]+}}(%esp) +; X86-SSE2-NEXT: fnstcw (%esp) +; X86-SSE2-NEXT: movzwl (%esp), %eax +; X86-SSE2-NEXT: orl $3072, %eax # imm = 0xC00 +; X86-SSE2-NEXT: movw %ax, {{[0-9]+}}(%esp) +; X86-SSE2-NEXT: fldcw {{[0-9]+}}(%esp) +; X86-SSE2-NEXT: fistpl {{[0-9]+}}(%esp) +; X86-SSE2-NEXT: fldcw (%esp) +; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-SSE2-NEXT: addl $8, %esp +; X86-SSE2-NEXT: retl ; ; X64-SSE2-WIN-LABEL: x_to_s32: ; X64-SSE2-WIN: # %bb.0: @@ -688,73 +643,35 @@ define i32 @x_to_s32(x86_fp80 %a) nounwind { ; X64-SSE2-LIN-NEXT: movl -{{[0-9]+}}(%rsp), %eax ; X64-SSE2-LIN-NEXT: retq ; -; X86-SSE1-WIN-LABEL: x_to_s32: -; X86-SSE1-WIN: # %bb.0: -; X86-SSE1-WIN-NEXT: pushl %ebp -; X86-SSE1-WIN-NEXT: movl %esp, %ebp -; X86-SSE1-WIN-NEXT: andl $-16, %esp -; X86-SSE1-WIN-NEXT: subl $16, %esp -; X86-SSE1-WIN-NEXT: fldt 8(%ebp) -; X86-SSE1-WIN-NEXT: fnstcw (%esp) -; X86-SSE1-WIN-NEXT: movzwl (%esp), %eax -; X86-SSE1-WIN-NEXT: orl $3072, %eax # imm = 0xC00 -; X86-SSE1-WIN-NEXT: movw %ax, {{[0-9]+}}(%esp) -; X86-SSE1-WIN-NEXT: fldcw {{[0-9]+}}(%esp) -; X86-SSE1-WIN-NEXT: fistpl {{[0-9]+}}(%esp) -; X86-SSE1-WIN-NEXT: fldcw (%esp) -; X86-SSE1-WIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE1-WIN-NEXT: movl %ebp, %esp -; X86-SSE1-WIN-NEXT: popl %ebp -; X86-SSE1-WIN-NEXT: retl -; -; X86-SSE1-LIN-LABEL: x_to_s32: -; X86-SSE1-LIN: # %bb.0: -; X86-SSE1-LIN-NEXT: subl $8, %esp -; X86-SSE1-LIN-NEXT: fldt {{[0-9]+}}(%esp) -; X86-SSE1-LIN-NEXT: fnstcw (%esp) -; X86-SSE1-LIN-NEXT: movzwl (%esp), %eax -; X86-SSE1-LIN-NEXT: orl $3072, %eax # imm = 0xC00 -; X86-SSE1-LIN-NEXT: movw %ax, {{[0-9]+}}(%esp) -; X86-SSE1-LIN-NEXT: fldcw {{[0-9]+}}(%esp) -; X86-SSE1-LIN-NEXT: fistpl {{[0-9]+}}(%esp) -; X86-SSE1-LIN-NEXT: fldcw (%esp) -; X86-SSE1-LIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X86-SSE1-LIN-NEXT: addl $8, %esp -; X86-SSE1-LIN-NEXT: retl -; -; X87-WIN-LABEL: x_to_s32: -; X87-WIN: # %bb.0: -; X87-WIN-NEXT: pushl %ebp -; X87-WIN-NEXT: movl %esp, %ebp -; X87-WIN-NEXT: andl $-16, %esp -; X87-WIN-NEXT: subl $16, %esp -; X87-WIN-NEXT: fldt 8(%ebp) -; X87-WIN-NEXT: fnstcw (%esp) -; X87-WIN-NEXT: movzwl (%esp), %eax -; X87-WIN-NEXT: orl $3072, %eax # imm = 0xC00 -; X87-WIN-NEXT: movw %ax, {{[0-9]+}}(%esp) -; X87-WIN-NEXT: fldcw {{[0-9]+}}(%esp) -; X87-WIN-NEXT: fistpl {{[0-9]+}}(%esp) -; X87-WIN-NEXT: fldcw (%esp) -; X87-WIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X87-WIN-NEXT: movl %ebp, %esp -; X87-WIN-NEXT: popl %ebp -; X87-WIN-NEXT: retl +; X86-SSE1-LABEL: x_to_s32: +; X86-SSE1: # %bb.0: +; X86-SSE1-NEXT: subl $8, %esp +; X86-SSE1-NEXT: fldt {{[0-9]+}}(%esp) +; X86-SSE1-NEXT: fnstcw (%esp) +; X86-SSE1-NEXT: movzwl (%esp), %eax +; X86-SSE1-NEXT: orl $3072, %eax # imm = 0xC00 +; X86-SSE1-NEXT: movw %ax, {{[0-9]+}}(%esp) +; X86-SSE1-NEXT: fldcw {{[0-9]+}}(%esp) +; X86-SSE1-NEXT: fistpl {{[0-9]+}}(%esp) +; X86-SSE1-NEXT: fldcw (%esp) +; X86-SSE1-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-SSE1-NEXT: addl $8, %esp +; X86-SSE1-NEXT: retl ; -; X87-LIN-LABEL: x_to_s32: -; X87-LIN: # %bb.0: -; X87-LIN-NEXT: subl $8, %esp -; X87-LIN-NEXT: fldt {{[0-9]+}}(%esp) -; X87-LIN-NEXT: fnstcw (%esp) -; X87-LIN-NEXT: movzwl (%esp), %eax -; X87-LIN-NEXT: orl $3072, %eax # imm = 0xC00 -; X87-LIN-NEXT: movw %ax, {{[0-9]+}}(%esp) -; X87-LIN-NEXT: fldcw {{[0-9]+}}(%esp) -; X87-LIN-NEXT: fistpl {{[0-9]+}}(%esp) -; X87-LIN-NEXT: fldcw (%esp) -; X87-LIN-NEXT: movl {{[0-9]+}}(%esp), %eax -; X87-LIN-NEXT: addl $8, %esp -; X87-LIN-NEXT: retl +; X87-LABEL: x_to_s32: +; X87: # %bb.0: +; X87-NEXT: subl $8, %esp +; X87-NEXT: fldt {{[0-9]+}}(%esp) +; X87-NEXT: fnstcw (%esp) +; X87-NEXT: movzwl (%esp), %eax +; X87-NEXT: orl $3072, %eax # imm = 0xC00 +; X87-NEXT: movw %ax, {{[0-9]+}}(%esp) +; X87-NEXT: fldcw {{[0-9]+}}(%esp) +; X87-NEXT: fistpl {{[0-9]+}}(%esp) +; X87-NEXT: fldcw (%esp) +; X87-NEXT: movl {{[0-9]+}}(%esp), %eax +; X87-NEXT: addl $8, %esp +; X87-NEXT: retl %r = fptosi x86_fp80 %a to i32 ret i32 %r } diff --git a/llvm/test/CodeGen/X86/scalar-fp-to-i64.ll b/llvm/test/CodeGen/X86/scalar-fp-to-i64.ll index 718b8b5..0ce9c87 100644 --- a/llvm/test/CodeGen/X86/scalar-fp-to-i64.ll +++ b/llvm/test/CodeGen/X86/scalar-fp-to-i64.ll @@ -909,8 +909,8 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; X86-AVX512-WIN: # %bb.0: ; X86-AVX512-WIN-NEXT: pushl %ebp ; X86-AVX512-WIN-NEXT: movl %esp, %ebp -; X86-AVX512-WIN-NEXT: andl $-16, %esp -; X86-AVX512-WIN-NEXT: subl $16, %esp +; X86-AVX512-WIN-NEXT: andl $-8, %esp +; X86-AVX512-WIN-NEXT: subl $8, %esp ; X86-AVX512-WIN-NEXT: fldt 8(%ebp) ; X86-AVX512-WIN-NEXT: flds __real@5f000000 ; X86-AVX512-WIN-NEXT: xorl %edx, %edx @@ -985,8 +985,8 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; X86-SSE3-WIN: # %bb.0: ; X86-SSE3-WIN-NEXT: pushl %ebp ; X86-SSE3-WIN-NEXT: movl %esp, %ebp -; X86-SSE3-WIN-NEXT: andl $-16, %esp -; X86-SSE3-WIN-NEXT: subl $16, %esp +; X86-SSE3-WIN-NEXT: andl $-8, %esp +; X86-SSE3-WIN-NEXT: subl $8, %esp ; X86-SSE3-WIN-NEXT: fldt 8(%ebp) ; X86-SSE3-WIN-NEXT: flds __real@5f000000 ; X86-SSE3-WIN-NEXT: xorl %edx, %edx @@ -1061,8 +1061,8 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; X86-SSE2-WIN: # %bb.0: ; X86-SSE2-WIN-NEXT: pushl %ebp ; X86-SSE2-WIN-NEXT: movl %esp, %ebp -; X86-SSE2-WIN-NEXT: andl $-16, %esp -; X86-SSE2-WIN-NEXT: subl $32, %esp +; X86-SSE2-WIN-NEXT: andl $-8, %esp +; X86-SSE2-WIN-NEXT: subl $16, %esp ; X86-SSE2-WIN-NEXT: fldt 8(%ebp) ; X86-SSE2-WIN-NEXT: flds __real@5f000000 ; X86-SSE2-WIN-NEXT: xorl %edx, %edx @@ -1161,8 +1161,8 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; X87-WIN: # %bb.0: ; X87-WIN-NEXT: pushl %ebp ; X87-WIN-NEXT: movl %esp, %ebp -; X87-WIN-NEXT: andl $-16, %esp -; X87-WIN-NEXT: subl $32, %esp +; X87-WIN-NEXT: andl $-8, %esp +; X87-WIN-NEXT: subl $16, %esp ; X87-WIN-NEXT: fldt 8(%ebp) ; X87-WIN-NEXT: flds __real@5f000000 ; X87-WIN-NEXT: fucom %st(1) @@ -1235,8 +1235,8 @@ define i64 @x_to_s64(x86_fp80 %a) nounwind { ; X86-AVX512-WIN: # %bb.0: ; X86-AVX512-WIN-NEXT: pushl %ebp ; X86-AVX512-WIN-NEXT: movl %esp, %ebp -; X86-AVX512-WIN-NEXT: andl $-16, %esp -; X86-AVX512-WIN-NEXT: subl $16, %esp +; X86-AVX512-WIN-NEXT: andl $-8, %esp +; X86-AVX512-WIN-NEXT: subl $8, %esp ; X86-AVX512-WIN-NEXT: fldt 8(%ebp) ; X86-AVX512-WIN-NEXT: fisttpll (%esp) ; X86-AVX512-WIN-NEXT: movl (%esp), %eax @@ -1275,8 +1275,8 @@ define i64 @x_to_s64(x86_fp80 %a) nounwind { ; X86-SSE3-WIN: # %bb.0: ; X86-SSE3-WIN-NEXT: pushl %ebp ; X86-SSE3-WIN-NEXT: movl %esp, %ebp -; X86-SSE3-WIN-NEXT: andl $-16, %esp -; X86-SSE3-WIN-NEXT: subl $16, %esp +; X86-SSE3-WIN-NEXT: andl $-8, %esp +; X86-SSE3-WIN-NEXT: subl $8, %esp ; X86-SSE3-WIN-NEXT: fldt 8(%ebp) ; X86-SSE3-WIN-NEXT: fisttpll (%esp) ; X86-SSE3-WIN-NEXT: movl (%esp), %eax @@ -1315,8 +1315,8 @@ define i64 @x_to_s64(x86_fp80 %a) nounwind { ; X86-SSE2-WIN: # %bb.0: ; X86-SSE2-WIN-NEXT: pushl %ebp ; X86-SSE2-WIN-NEXT: movl %esp, %ebp -; X86-SSE2-WIN-NEXT: andl $-16, %esp -; X86-SSE2-WIN-NEXT: subl $32, %esp +; X86-SSE2-WIN-NEXT: andl $-8, %esp +; X86-SSE2-WIN-NEXT: subl $16, %esp ; X86-SSE2-WIN-NEXT: fldt 8(%ebp) ; X86-SSE2-WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; X86-SSE2-WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax @@ -1379,8 +1379,8 @@ define i64 @x_to_s64(x86_fp80 %a) nounwind { ; X87-WIN: # %bb.0: ; X87-WIN-NEXT: pushl %ebp ; X87-WIN-NEXT: movl %esp, %ebp -; X87-WIN-NEXT: andl $-16, %esp -; X87-WIN-NEXT: subl $32, %esp +; X87-WIN-NEXT: andl $-8, %esp +; X87-WIN-NEXT: subl $16, %esp ; X87-WIN-NEXT: fldt 8(%ebp) ; X87-WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; X87-WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax diff --git a/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp b/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp index 0c83574..ec90047 100644 --- a/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp +++ b/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp @@ -24,7 +24,7 @@ TEST(DataLayoutUpgradeTest, ValidDataLayoutUpgrade) { EXPECT_EQ(DL1, "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64" "-f80:128-n8:16:32:64-S128"); EXPECT_EQ(DL2, "e-m:w-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64" - "-f80:128-n8:16:32-S32"); + "-f80:32-n8:16:32-S32"); EXPECT_EQ(DL3, "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128" "-n32:64-S128"); -- 2.7.4