* [edk2-devel] MOV64 and CLANGPDB @ 2025-02-13 22:33 Leif Lindholm via groups.io 2025-02-14 1:54 ` Michael Kubacki via groups.io 0 siblings, 1 reply; 4+ messages in thread From: Leif Lindholm via groups.io @ 2025-02-13 22:33 UTC (permalink / raw) To: devel; +Cc: Michael Kubacki, Ard Biesheuvel I would very much like to have a MOV64 that's universally usable. That's sort of the point. However, I'm wondering if the error is in fact triggered by the first stanza (movz), which doesn't mask its result, and will have 48 sign extended bits above the ones we care about for the instruction. Annoyingly I cannot reproduce the build error in my setup, so I can't verify if that is the problem. Michael, could you possibly do a test and change movz Reg, (Val) >> 48, lsl #48 ; \ to movz Reg, ((Val) >> 48) & 0xffff, lsl #48 ; \ on line 51 in MdePkg/Include/AArch64/AsmMacroLib.h ? And then rebuild the MOV64 version of ArmStandaloneMmCoreEntryPoint? / Leif -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121119): https://edk2.groups.io/g/devel/message/121119 Mute This Topic: https://groups.io/mt/111172486/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] MOV64 and CLANGPDB 2025-02-13 22:33 [edk2-devel] MOV64 and CLANGPDB Leif Lindholm via groups.io @ 2025-02-14 1:54 ` Michael Kubacki via groups.io 2025-02-14 10:48 ` Leif Lindholm via groups.io 0 siblings, 1 reply; 4+ messages in thread From: Michael Kubacki via groups.io @ 2025-02-14 1:54 UTC (permalink / raw) To: devel, leif.lindholm; +Cc: Ard Biesheuvel That worked. Let me know what you'd like to do with https://github.com/tianocore/edk2/pull/10760. --- Before (original code) ...ModuleEntryPoint.iiii:58:12: error: immediate must be an integer in range [0, 65535]. movz x9, (-1) >> 48, lsl #48 ; movk x9, ((-1) >> 32) & 0xffff, lsl #32 ; movk x9, ((-1) >> 16) & 0xffff, lsl #16 ; movk x9, (-1) & 0xffff --- After (new code) svc #0 movz x9, ((-1) >> 48) & 0xffff, lsl #48 ; movk x9, ((-1) >> 32) & 0xffff, lsl #32 ; movk x9, ((-1) >> 16) & 0xffff, lsl #16 ; movk x9, (-1) & 0xffff cmp x0, x9 cset x0, ne mov x9, xzr ret --- On 2/13/2025 5:33 PM, Leif Lindholm via groups.io wrote: > I would very much like to have a MOV64 that's universally usable. > That's sort of the point. > > However, I'm wondering if the error is in fact triggered by the first > stanza (movz), which doesn't mask its result, and will have 48 sign > extended bits above the ones we care about for the instruction. > > Annoyingly I cannot reproduce the build error in my setup, so I can't > verify if that is the problem. > > Michael, could you possibly do a test and change > movz Reg, (Val) >> 48, lsl #48 ; \ > to > movz Reg, ((Val) >> 48) & 0xffff, lsl #48 ; \ > > on line 51 in MdePkg/Include/AArch64/AsmMacroLib.h ? > > And then rebuild the MOV64 version of ArmStandaloneMmCoreEntryPoint? > > / > Leif > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121120): https://edk2.groups.io/g/devel/message/121120 Mute This Topic: https://groups.io/mt/111172486/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] MOV64 and CLANGPDB 2025-02-14 1:54 ` Michael Kubacki via groups.io @ 2025-02-14 10:48 ` Leif Lindholm via groups.io 2025-02-14 14:25 ` Michael Kubacki via groups.io 0 siblings, 1 reply; 4+ messages in thread From: Leif Lindholm via groups.io @ 2025-02-14 10:48 UTC (permalink / raw) To: Michael Kubacki; +Cc: devel, Ard Biesheuvel On Fri, 14 Feb 2025 at 01:54, Michael Kubacki <mikuback@linux.microsoft.com> wrote: > That worked. Splendid! Thanks. Ard figured out how to reproduce the issue as well - the behaviour changes between -target aarch64-windows-none and -target aarch64-linux-gnu, so more LLP64 fun. > Let me know what you'd like to do with > https://github.com/tianocore/edk2/pull/10760. I would prefer to fix the MOV64 macro and leave the invocation alone for now. If the optimization ot doing the direct mov is important enough, that can be done separately at a later point. I pushed a fix to https://github.com/leiflindholm/edk2/commit/a7ff8aebcad1a6621ac52007b6dc530972b26125 that you could cherry-pick into the PR. Are you looking for this PR to hit the stable tag? If not, the MOVx4 fix can wait too. / Leif > --- > > Before (original code) > > ...ModuleEntryPoint.iiii:58:12: error: immediate must be an integer in > range [0, 65535]. > > movz x9, (-1) >> 48, lsl #48 ; movk x9, ((-1) >> 32) & 0xffff, lsl #32 ; > movk x9, ((-1) >> 16) & 0xffff, lsl #16 ; movk x9, (-1) & 0xffff > > --- > > After (new code) > > svc #0 > > movz x9, ((-1) >> 48) & 0xffff, lsl #48 ; movk x9, ((-1) >> 32) & > 0xffff, lsl #32 ; movk x9, ((-1) >> 16) & 0xffff, lsl #16 ; movk x9, > (-1) & 0xffff > cmp x0, x9 > cset x0, ne > mov x9, xzr > ret > > --- > > On 2/13/2025 5:33 PM, Leif Lindholm via groups.io wrote: > > I would very much like to have a MOV64 that's universally usable. > > That's sort of the point. > > > > However, I'm wondering if the error is in fact triggered by the first > > stanza (movz), which doesn't mask its result, and will have 48 sign > > extended bits above the ones we care about for the instruction. > > > > Annoyingly I cannot reproduce the build error in my setup, so I can't > > verify if that is the problem. > > > > Michael, could you possibly do a test and change > > movz Reg, (Val) >> 48, lsl #48 ; \ > > to > > movz Reg, ((Val) >> 48) & 0xffff, lsl #48 ; \ > > > > on line 51 in MdePkg/Include/AArch64/AsmMacroLib.h ? > > > > And then rebuild the MOV64 version of ArmStandaloneMmCoreEntryPoint? > > > > / > > Leif > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121121): https://edk2.groups.io/g/devel/message/121121 Mute This Topic: https://groups.io/mt/111172486/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] MOV64 and CLANGPDB 2025-02-14 10:48 ` Leif Lindholm via groups.io @ 2025-02-14 14:25 ` Michael Kubacki via groups.io 0 siblings, 0 replies; 4+ messages in thread From: Michael Kubacki via groups.io @ 2025-02-14 14:25 UTC (permalink / raw) To: Leif Lindholm; +Cc: devel, Ard Biesheuvel Thanks https://github.com/tianocore/edk2/pull/10760 is updated. I don't have a strong need for it to make the stable tag. I have a local solution that can be used in the meantime. On 2/14/2025 5:48 AM, Leif Lindholm wrote: > On Fri, 14 Feb 2025 at 01:54, Michael Kubacki > <mikuback@linux.microsoft.com> wrote: >> That worked. > > Splendid! Thanks. > > Ard figured out how to reproduce the issue as well - the behaviour > changes between > -target aarch64-windows-none and -target aarch64-linux-gnu, so more LLP64 fun. > >> Let me know what you'd like to do with >> https://github.com/tianocore/edk2/pull/10760. > > I would prefer to fix the MOV64 macro and leave the invocation alone for now. > If the optimization ot doing the direct mov is important enough, that > can be done > separately at a later point. > > I pushed a fix to > https://github.com/leiflindholm/edk2/commit/a7ff8aebcad1a6621ac52007b6dc530972b26125 > that you could cherry-pick into the PR. > > Are you looking for this PR to hit the stable tag? > If not, the MOVx4 fix can wait too. > > / > Leif > >> --- >> >> Before (original code) >> >> ...ModuleEntryPoint.iiii:58:12: error: immediate must be an integer in >> range [0, 65535]. >> >> movz x9, (-1) >> 48, lsl #48 ; movk x9, ((-1) >> 32) & 0xffff, lsl #32 ; >> movk x9, ((-1) >> 16) & 0xffff, lsl #16 ; movk x9, (-1) & 0xffff >> >> --- >> >> After (new code) >> >> svc #0 >> >> movz x9, ((-1) >> 48) & 0xffff, lsl #48 ; movk x9, ((-1) >> 32) & >> 0xffff, lsl #32 ; movk x9, ((-1) >> 16) & 0xffff, lsl #16 ; movk x9, >> (-1) & 0xffff >> cmp x0, x9 >> cset x0, ne >> mov x9, xzr >> ret >> >> --- >> >> On 2/13/2025 5:33 PM, Leif Lindholm via groups.io wrote: >>> I would very much like to have a MOV64 that's universally usable. >>> That's sort of the point. >>> >>> However, I'm wondering if the error is in fact triggered by the first >>> stanza (movz), which doesn't mask its result, and will have 48 sign >>> extended bits above the ones we care about for the instruction. >>> >>> Annoyingly I cannot reproduce the build error in my setup, so I can't >>> verify if that is the problem. >>> >>> Michael, could you possibly do a test and change >>> movz Reg, (Val) >> 48, lsl #48 ; \ >>> to >>> movz Reg, ((Val) >> 48) & 0xffff, lsl #48 ; \ >>> >>> on line 51 in MdePkg/Include/AArch64/AsmMacroLib.h ? >>> >>> And then rebuild the MOV64 version of ArmStandaloneMmCoreEntryPoint? >>> >>> / >>> Leif >>> >>> >>> >>> >> -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121122): https://edk2.groups.io/g/devel/message/121122 Mute This Topic: https://groups.io/mt/111172486/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-14 14:25 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-13 22:33 [edk2-devel] MOV64 and CLANGPDB Leif Lindholm via groups.io 2025-02-14 1:54 ` Michael Kubacki via groups.io 2025-02-14 10:48 ` Leif Lindholm via groups.io 2025-02-14 14:25 ` Michael Kubacki via groups.io
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox