[all-commits] [llvm/llvm-project] ef8e03: [llvm][aarch64] Add support for the MS qualifiers ...

Daniel Paoliello via All-commits all-commits at lists.llvm.org
Fri Jan 31 10:40:16 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ef8e0330801b43f8c7bec81c649d5a3e86238d7f
      https://github.com/llvm/llvm-project/commit/ef8e0330801b43f8c7bec81c649d5a3e86238d7f
  Author: Daniel Paoliello <danpao at microsoft.com>
  Date:   2025-01-31 (Fri, 31 Jan 2025)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.h
    M llvm/lib/Target/AArch64/AArch64TargetMachine.h
    M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    A llvm/test/CodeGen/AArch64/aarch64-mixed-ptr-sizes.ll
    M llvm/test/CodeGen/X86/mixed-ptr-sizes.ll

  Log Message:
  -----------
  [llvm][aarch64] Add support for the MS qualifiers __ptr32, __ptr64, _sptr, __uptr (#112793)

MSVC has a set of qualifiers to allow using 32-bit signed/unsigned
pointers when building 64-bit targets. This is useful for WoW code
(i.e., the part of Windows that handles running 32-bit application on a
64-bit OS). Currently this is supported on x64 using the 270, 271 and
272 address spaces, but does not work for AArch64 at all.

This change handles pointers in the new address spaces by truncating or
extending the value as required. The implementation is modeled after
x86.

Note that the initial version of this change that was never merged
(<https://reviews.llvm.org/D158931>) took a much different approach that
involved arch-specific handling in the DAG combiner/selector, which
didn't feel like the correct approach.

That previous approach also used `UBFM` for all 32-bit to 64-bit
zero-extensions, which resulted in a lot of `lsr` instructions being
added. For example, in the `ptradd.ll` test, it resulted in:

```
  %add = add i32 %b, %a
  %conv = zext i32 %add to i64
```

Being expanded to:
```
        add     w8, w1, w0
        lsr     w0, w8, #0
```

Where the `lsr` instruction wasn't previously being added. I don't know
enough about the exact details of AArch64 to know if that's a desirable
change, so I've left it out of my change.
 
Backend half of #111879



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list