Krzysztof Parzyszek via llvm-dev
2016-Sep-28 17:52 UTC
[llvm-dev] Reg units for unaddressable register parts?
On X86, the registers AX, EAX and RAX all share the exact same register units. In terms of units, there is no difference between these registers. This makes register units insufficient to track liveness, since live AX does not imply live EAX. Would it make sense to have register units (and lane masks) for the parts of registers that are not individually addressable? -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Krzysztof Parzyszek via llvm-dev
2016-Sep-28 17:54 UTC
[llvm-dev] Reg units for unaddressable register parts?
On 9/28/2016 12:52 PM, Krzysztof Parzyszek via llvm-dev wrote:> Would it make sense to have register units (and lane masks) for the > parts of registers that are not individually addressable?With this arrangement, each register would be covered by its units. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quentin Colombet via llvm-dev
2016-Sep-28 18:20 UTC
[llvm-dev] Reg units for unaddressable register parts?
> On Sep 28, 2016, at 10:52 AM, Krzysztof Parzyszek via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On X86, the registers AX, EAX and RAX all share the exact same register units. In terms of units, there is no difference between these registers. This makes register units insufficient to track liveness, since live AX does not imply live EAX.That is exactly the intent. If AX is live, you don’t want another value to use EAX or RAX.> > Would it make sense to have register units (and lane masks) for the parts of registers that are not individually addressable? > > -Krzysztof > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Krzysztof Parzyszek via llvm-dev
2016-Sep-28 18:32 UTC
[llvm-dev] Reg units for unaddressable register parts?
On 9/28/2016 1:20 PM, Quentin Colombet wrote:> >> On Sep 28, 2016, at 10:52 AM, Krzysztof Parzyszek via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> On X86, the registers AX, EAX and RAX all share the exact same register units. In terms of units, there is no difference between these registers. This makes register units insufficient to track liveness, since live AX does not imply live EAX. > > That is exactly the intent. > If AX is live, you don’t want another value to use EAX or RAX.I'm not sure what value you are referring to. I have this situation in mind: RAX = ... (1) EAX = ... (2) ... = RAX (3) There doesn't seem to be a way to determine whether (1) is live based on lane masks, and to distinguish it from EAX = ... (1) RAX = ... (2) ... = RAX (3) -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Matthias Braun via llvm-dev
2016-Sep-28 18:45 UTC
[llvm-dev] Reg units for unaddressable register parts?
> On Sep 28, 2016, at 11:20 AM, Quentin Colombet via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > >> On Sep 28, 2016, at 10:52 AM, Krzysztof Parzyszek via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> On X86, the registers AX, EAX and RAX all share the exact same register units. In terms of units, there is no difference between these registers. This makes register units insufficient to track liveness, since live AX does not imply live EAX. > > That is exactly the intent. > If AX is live, you don’t want another value to use EAX or RAX.You can track liveness but you may have to make conservative assumptions like the whole RAX register being live even though it may only be AL+AH in reality. Usually that is good enough (it is for the register allocator!). There are very few cases where the difference matters. The only ones I can think of right now are ABIs corner cases (see below [1]) and X86FixupBWInsts. In general however we should be careful not to produce unnecessary/extra regunits, that will just increase memory consumption and slow down the compiler. Having said that I wouldn't mind producing enough extra regunits to be able to express clobber masks in register units. Generally producing regunits for all unaddressable parts is not a good idea IMO. [1] ABIs: x86 / win64 calling convention preserves a bunch of XMM registers but not the corresponding YMM registers => the lower 128bit are saved, the upper 128 bit of the YMM register are clobbered. AArch64: Preserves the 64bit of several float register (Dxx) but not the upper parts (Qxx). This forces us to express the clobbered register masks in terms of physreg numbers and not register unit which is unfortunate as we are usually better of expressing liveness in registser units. - Matthias