Article View: comp.arch
Article #807Re: Large constants in RISC
From: aph
Date: Thu, 19 Nov 2026 09:42
Date: Thu, 19 Nov 2026 09:42
31 lines
2847 bytes
2847 bytes
John Savard <quadibloc@invalid.com> wrote: > On Sat, 14 Nov 2026 19:10:17 GMT, anton@mips.complang.tuwien.ac.at > (Anton Ertl) wrote: >>antispam@fricas.org (Waldek Hebisch) writes: >>>I read what he wrote and I do not doubt that code having constants >>>in instructions is faster. >> >>AMD64 has large constants (or at least better support for large >>constants than ARM A64), yet according to reviews ARM A64 >>implementations form Apple and IIRC also Qualcomm offer better >>performance than the best AMD64 implementations. > > Why do you say "yet", given that support for large constants is not > something that mitigates against performance? > > Oh, I'm sorry: I misread what you wrote. I assumed ARM A64 had the > better support for large constants, and didn't see the letters on the > screen in front of me. In a way, it does. Most large constants I see are addresses. AArch64 (almost) always has a 48-bit user space, so except for floating-point doubles and the very occasional large integer, constant loads look like mov x0, 42857; movk x0, 0x60b8, lsl 16; movk x0, 0xaaaa, lsl 32 which is three 32-bit instructions, 12 bytes. x86-64 movabs is 10 bytes, so in practice the difference doesn't really matter, and there are more productive ways to look for code density improvements. Andrew.
Technical Details
Message-ID:
<SYScnWsR3rgGWWP3nZ2dnZfqn_WdnZ2d@supernews.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mailReferences:
<11d76uq$11cdc$1@paganini.bofh.team> <11d7ct8$17akn$1@dont-email.me> <11d7ih2$11orr$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <2026Nov14.201017@mips.complang.tuwien.ac.at> <6af911ea.18530156@news.eternal-september.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 19 Nov 2026 09:42:51 +0000
Sender: Andrew Haley <aph@li-f2cf9ecc-3241-11b2-a85c-b613f11f80f0.ibm.com>
From: aph@littlepinkcloud.invalid
Subject: Re: Large constants in RISC
Newsgroups: comp.arch
References: <11d76uq$11cdc$1@paganini.bofh.team> <11d7ct8$17akn$1@dont-email.me> <11d7ih2$11orr$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <2026Nov14.201017@mips.complang.tuwien.ac.at> <6af911ea.18530156@news.eternal-september.org>
User-Agent: tin/1.9.2-20070201 ("Dalaruan") (UNIX) (Linux/7.3.3-100.fc43.x86_64 (x86_64))
Message-ID: <SYScnWsR3rgGWWP3nZ2dnZfqn_WdnZ2d@supernews.com>
Date: Thu, 19 Nov 2026 09:42:51 +0000
Lines: 31
X-Trace: sv3-kRUAuNQg1OsW0RGBTV7R2DKprzDSP8F0mE+GjfkpN/p2wcIgXd5E8gCgbOCAvBpxUtEc/fxzJRJH86p!vM3FNL+sjej7czuCuny0LF0Co4U6py0MpYXpX/pTRgkBPAsnEyodawXk5RwbdrLWU7aVI+0H+a+m!w+TJQOJXSn8E
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40