Page MenuHomePhabricator

[X86] Add TLS_(base_)addrX32 for X32 mode
ClosedPublic

Authored by hvdijk on Nov 30 2020, 1:25 PM.

Details

Summary

LLVM has TLS_(base_)addr32 for 32-bit TLS addresses in 32-bit mode, and TLS_(base_)addr64 for 64-bit TLS addresses in 64-bit mode. x32 mode wants 32-bit TLS addresses in 64-bit mode, which were not yet handled. This adds TLS_(base_)addrX32 as copies of TLS_(base_)addr64, except that they use tls32(base)addr rather than tls64(base)addr, and then restricts TLS_(base_)addr64 to 64-bit LP64 mode, TLS_(base_)addrX32 to 64-bit ILP32 mode.

This diff by itself results in invalid code due to wrongly using the EBX register; the included test will fail. D16474 needs to be applied first, then this on top.

Diff Detail

Unit TestsFailed

TimeTest
360 msx64 debian > LLVM.CodeGen/X86::pic.ll
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc < /mnt/disks/ssd0/agent/llvm-project/llvm/test/CodeGen/X86/pic.ll -mcpu=generic -mtriple=i686-pc-linux-gnu -relocation-model=pic -asm-verbose=false -post-RA-scheduler=false -verify-machineinstrs | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/CodeGen/X86/pic.ll -check-prefixes=CHECK,CHECK-I686
370 msx64 windows > LLVM.CodeGen/X86::pic.ll
Script: -- : 'RUN: at line 1'; c:\ws\w16-1\llvm-project\premerge-checks\build\bin\llc.exe < C:\ws\w16-1\llvm-project\premerge-checks\llvm\test\CodeGen\X86\pic.ll -mcpu=generic -mtriple=i686-pc-linux-gnu -relocation-model=pic -asm-verbose=false -post-RA-scheduler=false -verify-machineinstrs | c:\ws\w16-1\llvm-project\premerge-checks\build\bin\filecheck.exe C:\ws\w16-1\llvm-project\premerge-checks\llvm\test\CodeGen\X86\pic.ll -check-prefixes=CHECK,CHECK-I686

Event Timeline

hvdijk created this revision.Nov 30 2020, 1:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2020, 1:25 PM
hvdijk requested review of this revision.Nov 30 2020, 1:25 PM
RKSimon accepted this revision.Dec 2 2020, 8:20 AM

LGTM cheers

This revision is now accepted and ready to land.Dec 2 2020, 8:20 AM
This revision was landed with ongoing or failed builds.Dec 2 2020, 2:21 PM
This revision was automatically updated to reflect the committed changes.