This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG37d1d02200b9: [X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match… (authored by pengfei).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115942/new/ https://reviews.llvm.org/D115942 Files: clang/lib/Basic/Targets/X86.h clang/test/CodeGen/target-data.c llvm/lib/IR/AutoUpgrade.cpp llvm/lib/Target/X86/X86TargetMachine.cpp llvm/test/Bitcode/upgrade-datalayout3.ll llvm/test/Bitcode/upgrade-datalayout4.ll llvm/test/CodeGen/X86/long-double-abi-align.ll llvm/test/CodeGen/X86/scalar-fp-to-i32.ll llvm/test/CodeGen/X86/scalar-fp-to-i64.ll llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp
Index: llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp =================================================================== --- llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp +++ llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp @@ -24,7 +24,7 @@ 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:32-n8:16:32-S32"); + "-f80:128-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"); Index: llvm/test/CodeGen/X86/scalar-fp-to-i64.ll =================================================================== --- llvm/test/CodeGen/X86/scalar-fp-to-i64.ll +++ llvm/test/CodeGen/X86/scalar-fp-to-i64.ll @@ -909,8 +909,8 @@ ; X86-AVX512-WIN: # %bb.0: ; X86-AVX512-WIN-NEXT: pushl %ebp ; X86-AVX512-WIN-NEXT: movl %esp, %ebp -; X86-AVX512-WIN-NEXT: andl $-8, %esp -; X86-AVX512-WIN-NEXT: subl $8, %esp +; 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: flds __real@5f000000 ; X86-AVX512-WIN-NEXT: xorl %edx, %edx @@ -985,8 +985,8 @@ ; X86-SSE3-WIN: # %bb.0: ; X86-SSE3-WIN-NEXT: pushl %ebp ; X86-SSE3-WIN-NEXT: movl %esp, %ebp -; X86-SSE3-WIN-NEXT: andl $-8, %esp -; X86-SSE3-WIN-NEXT: subl $8, %esp +; 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: flds __real@5f000000 ; X86-SSE3-WIN-NEXT: xorl %edx, %edx @@ -1061,8 +1061,8 @@ ; X86-SSE2-WIN: # %bb.0: ; X86-SSE2-WIN-NEXT: pushl %ebp ; X86-SSE2-WIN-NEXT: movl %esp, %ebp -; X86-SSE2-WIN-NEXT: andl $-8, %esp -; X86-SSE2-WIN-NEXT: subl $16, %esp +; X86-SSE2-WIN-NEXT: andl $-16, %esp +; X86-SSE2-WIN-NEXT: subl $32, %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 @@ ; X87-WIN: # %bb.0: ; X87-WIN-NEXT: pushl %ebp ; X87-WIN-NEXT: movl %esp, %ebp -; X87-WIN-NEXT: andl $-8, %esp -; X87-WIN-NEXT: subl $16, %esp +; X87-WIN-NEXT: andl $-16, %esp +; X87-WIN-NEXT: subl $32, %esp ; X87-WIN-NEXT: fldt 8(%ebp) ; X87-WIN-NEXT: flds __real@5f000000 ; X87-WIN-NEXT: fucom %st(1) @@ -1235,8 +1235,8 @@ ; X86-AVX512-WIN: # %bb.0: ; X86-AVX512-WIN-NEXT: pushl %ebp ; X86-AVX512-WIN-NEXT: movl %esp, %ebp -; X86-AVX512-WIN-NEXT: andl $-8, %esp -; X86-AVX512-WIN-NEXT: subl $8, %esp +; 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: fisttpll (%esp) ; X86-AVX512-WIN-NEXT: movl (%esp), %eax @@ -1275,8 +1275,8 @@ ; X86-SSE3-WIN: # %bb.0: ; X86-SSE3-WIN-NEXT: pushl %ebp ; X86-SSE3-WIN-NEXT: movl %esp, %ebp -; X86-SSE3-WIN-NEXT: andl $-8, %esp -; X86-SSE3-WIN-NEXT: subl $8, %esp +; 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: fisttpll (%esp) ; X86-SSE3-WIN-NEXT: movl (%esp), %eax @@ -1315,8 +1315,8 @@ ; X86-SSE2-WIN: # %bb.0: ; X86-SSE2-WIN-NEXT: pushl %ebp ; X86-SSE2-WIN-NEXT: movl %esp, %ebp -; X86-SSE2-WIN-NEXT: andl $-8, %esp -; X86-SSE2-WIN-NEXT: subl $16, %esp +; X86-SSE2-WIN-NEXT: andl $-16, %esp +; X86-SSE2-WIN-NEXT: subl $32, %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 @@ ; X87-WIN: # %bb.0: ; X87-WIN-NEXT: pushl %ebp ; X87-WIN-NEXT: movl %esp, %ebp -; X87-WIN-NEXT: andl $-8, %esp -; X87-WIN-NEXT: subl $16, %esp +; X87-WIN-NEXT: andl $-16, %esp +; X87-WIN-NEXT: subl $32, %esp ; X87-WIN-NEXT: fldt 8(%ebp) ; X87-WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; X87-WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax Index: llvm/test/CodeGen/X86/scalar-fp-to-i32.ll =================================================================== --- llvm/test/CodeGen/X86/scalar-fp-to-i32.ll +++ llvm/test/CodeGen/X86/scalar-fp-to-i32.ll @@ -344,8 +344,8 @@ ; X86-AVX512-WIN: # %bb.0: ; X86-AVX512-WIN-NEXT: pushl %ebp ; X86-AVX512-WIN-NEXT: movl %esp, %ebp -; X86-AVX512-WIN-NEXT: andl $-8, %esp -; X86-AVX512-WIN-NEXT: subl $8, %esp +; 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: fisttpll (%esp) ; X86-AVX512-WIN-NEXT: movl (%esp), %eax @@ -382,8 +382,8 @@ ; X86-SSE3-WIN: # %bb.0: ; X86-SSE3-WIN-NEXT: pushl %ebp ; X86-SSE3-WIN-NEXT: movl %esp, %ebp -; X86-SSE3-WIN-NEXT: andl $-8, %esp -; X86-SSE3-WIN-NEXT: subl $8, %esp +; 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: fisttpll (%esp) ; X86-SSE3-WIN-NEXT: movl (%esp), %eax @@ -420,8 +420,8 @@ ; X86-SSE2-WIN: # %bb.0: ; X86-SSE2-WIN-NEXT: pushl %ebp ; X86-SSE2-WIN-NEXT: movl %esp, %ebp -; X86-SSE2-WIN-NEXT: andl $-8, %esp -; X86-SSE2-WIN-NEXT: subl $16, %esp +; X86-SSE2-WIN-NEXT: andl $-16, %esp +; X86-SSE2-WIN-NEXT: subl $32, %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 @@ ; X86-SSE1-WIN: # %bb.0: ; X86-SSE1-WIN-NEXT: pushl %ebp ; X86-SSE1-WIN-NEXT: movl %esp, %ebp -; X86-SSE1-WIN-NEXT: andl $-8, %esp -; X86-SSE1-WIN-NEXT: subl $16, %esp +; X86-SSE1-WIN-NEXT: andl $-16, %esp +; X86-SSE1-WIN-NEXT: subl $32, %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 @@ ; X87-WIN: # %bb.0: ; X87-WIN-NEXT: pushl %ebp ; X87-WIN-NEXT: movl %esp, %ebp -; X87-WIN-NEXT: andl $-8, %esp -; X87-WIN-NEXT: subl $16, %esp +; X87-WIN-NEXT: andl $-16, %esp +; X87-WIN-NEXT: subl $32, %esp ; X87-WIN-NEXT: fldt 8(%ebp) ; X87-WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; X87-WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax @@ -550,14 +550,27 @@ } define i32 @x_to_s32(x86_fp80 %a) nounwind { -; 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 +; 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 ; ; X64-AVX512-WIN-LABEL: x_to_s32: ; X64-AVX512-WIN: # %bb.0: @@ -575,14 +588,27 @@ ; X64-AVX512-LIN-NEXT: movl -{{[0-9]+}}(%rsp), %eax ; X64-AVX512-LIN-NEXT: retq ; -; 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 +; 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 ; ; X64-SSE3-WIN-LABEL: x_to_s32: ; X64-SSE3-WIN: # %bb.0: @@ -600,20 +626,39 @@ ; X64-SSE3-LIN-NEXT: movl -{{[0-9]+}}(%rsp), %eax ; X64-SSE3-LIN-NEXT: retq ; -; 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 +; 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 ; ; X64-SSE2-WIN-LABEL: x_to_s32: ; X64-SSE2-WIN: # %bb.0: @@ -643,35 +688,73 @@ ; X64-SSE2-LIN-NEXT: movl -{{[0-9]+}}(%rsp), %eax ; X64-SSE2-LIN-NEXT: retq ; -; 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 +; 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 ; -; 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 +; 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 +; +; 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 %r = fptosi x86_fp80 %a to i32 ret i32 %r } Index: llvm/test/CodeGen/X86/long-double-abi-align.ll =================================================================== --- llvm/test/CodeGen/X86/long-double-abi-align.ll +++ llvm/test/CodeGen/X86/long-double-abi-align.ll @@ -11,7 +11,7 @@ ; MSVC-NEXT: movl %esp, %ebp ; MSVC-NEXT: andl $-16, %esp ; MSVC-NEXT: subl $32, %esp -; MSVC-NEXT: fldt 12(%ebp) +; MSVC-NEXT: fldt 24(%ebp) ; MSVC-NEXT: fstpt (%esp) ; MSVC-NEXT: leal 8(%ebp), %eax ; MSVC-NEXT: pushl %eax @@ -21,7 +21,7 @@ ; MSVC-NEXT: pushl %eax ; MSVC-NEXT: calll _escape ; MSVC-NEXT: addl $4, %esp -; MSVC-NEXT: leal 24(%ebp), %eax +; MSVC-NEXT: leal 40(%ebp), %eax ; MSVC-NEXT: pushl %eax ; MSVC-NEXT: calll _escape ; MSVC-NEXT: addl $4, %esp Index: llvm/test/Bitcode/upgrade-datalayout4.ll =================================================================== --- /dev/null +++ llvm/test/Bitcode/upgrade-datalayout4.ll @@ -0,0 +1,8 @@ +; Test to make sure datalayout is automatically upgraded. +; +; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s + +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" +target triple = "i686-pc-windows-msvc" + +; CHECK: 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" Index: llvm/test/Bitcode/upgrade-datalayout3.ll =================================================================== --- llvm/test/Bitcode/upgrade-datalayout3.ll +++ 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:32-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:128-n8:16:32-S32" Index: llvm/lib/Target/X86/X86TargetMachine.cpp =================================================================== --- llvm/lib/Target/X86/X86TargetMachine.cpp +++ llvm/lib/Target/X86/X86TargetMachine.cpp @@ -127,7 +127,7 @@ // Some ABIs align long double to 128 bits, others to 32. if (TT.isOSNaCl() || TT.isOSIAMCU()) ; // No f80 - else if (TT.isArch64Bit() || TT.isOSDarwin()) + else if (TT.isArch64Bit() || TT.isOSDarwin() || TT.isWindowsMSVCEnvironment()) Ret += "-f80:128"; else Ret += "-f80:32"; Index: llvm/lib/IR/AutoUpgrade.cpp =================================================================== --- llvm/lib/IR/AutoUpgrade.cpp +++ llvm/lib/IR/AutoUpgrade.cpp @@ -4576,18 +4576,31 @@ return DL.empty() ? std::string("G1") : (DL + "-G1").str(); } + std::string Res = DL.str(); + if (!T.isX86()) + return Res; + + // If the datalayout matches the expected format, add pointer size address + // spaces to the datalayout. 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 std::string(DL); + if (!DL.contains(AddrSpaces)) { + SmallVector<StringRef, 4> Groups; + Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)"); + if (R.match(DL, &Groups)) + Res = (Groups[1] + AddrSpaces + Groups[3]).str(); + } - SmallVector<StringRef, 4> Groups; - Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)"); - if (!R.match(DL, &Groups)) - return std::string(DL); + // 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(); + } - return (Groups[1] + AddrSpaces + Groups[3]).str(); + return Res; } void llvm::UpgradeAttributes(AttrBuilder &B) { Index: clang/test/CodeGen/target-data.c =================================================================== --- clang/test/CodeGen/target-data.c +++ 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:32-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:128-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 Index: clang/lib/Basic/Targets/X86.h =================================================================== --- clang/lib/Basic/Targets/X86.h +++ clang/lib/Basic/Targets/X86.h @@ -533,11 +533,12 @@ DoubleAlign = LongLongAlign = 64; bool IsWinCOFF = getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF(); - 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 ? "_" : ""); + 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 ? "_" : ""); } };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits