Article View: comp.arch
Article #788Re: Large constants in RISC
From: EricP
Date: Tue, 17 Nov 2026 14:38
Date: Tue, 17 Nov 2026 14:38
48 lines
2663 bytes
2663 bytes
On 2026-Nov-16 13:50, MitchAlsup wrote: > EricP <ThatWouldBeTelling@thevillage.com> posted: > >> On 2026-Nov-15 11:08, Anton Ertl wrote: > -------------- >> If I was using the constant table approach I would: >> >> - define for LD and ST instructions that if the base register was >> the zero register (R0 or R31) then it means use the 64-bit RIP. > > I used Rbase == R0 -> IP > >> - add scaled index LD and ST instructions with the following format: >> opcode 6b Rs1_base 5b Rs2_index 5b Rd/Rs3 5b data_type 3b scale 3b offset 5b >> Data types are signed integer: B, H, W, L float: S, D > > I used Rindex == R0 -> no indexing I considered that but decided scaled indexed was distinct enough to be worthy of its own instruction format. >> This can access anywhere in 64b address space in 2 instructions: > > I can access anywhere in 64-bit VAS in 1 instruction. Yes but this is working with fixed 32-bit instructions. The combination of two features, rBase == R0 => RIP and having scaled index LD/ST add the constant, that compacts RVs 5 instruction sequence into 2. > >> - use a small RIPrel offset to load the 64b RIPrel offset from the table >> = use the scaled index LD/ST with scale = 0, index = offset, and base RIP >> to address all of memory. >> >> For RIP-relative 64b addressing: >> >> LD.L r1 = [RIP + table_offset] >> LD.dt r2 = [RIP + r1<<0] > > LDs Rd,[Rbase,Rindex<<s,#table_offset] Yep, no question large immediates is better.
Technical Details
Message-ID:
<JFZKS.7287$ML4.2424@fx14.iad>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mailReferences:
<11d76uq$11cdc$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <11dabct$26fdl$1@dont-email.me> <11dahac$2t74$1@gal.iecc.com> <11dakku$29j9n$1@dont-email.me> <2026Nov15.170804@mips.complang.tuwien.ac.at> <JunKS.106396$Cm3.49782@fx47.iad> <1794855044-5857@newsgrouper.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: EricP <ThatWouldBeTelling@thevillage.com> Subject: Re: Large constants in RISC Newsgroups: comp.arch References: <11d76uq$11cdc$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <11dabct$26fdl$1@dont-email.me> <11dahac$2t74$1@gal.iecc.com> <11dakku$29j9n$1@dont-email.me> <2026Nov15.170804@mips.complang.tuwien.ac.at> <JunKS.106396$Cm3.49782@fx47.iad> <1794855044-5857@newsgrouper.org> Content-Language: en-CA In-Reply-To: <1794855044-5857@newsgrouper.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 48 Message-ID: <JFZKS.7287$ML4.2424@fx14.iad> X-Complaints-To: abuse@UsenetServer.com NNTP-Posting-Date: Tue, 17 Nov 2026 14:38:33 UTC Date: Tue, 17 Nov 2026 09:38:32 -0500 X-Received-Bytes: 2442