VC4ASM - Appendix - Small immediate values

↑ Top

The following values can be expressed as small immediate values in mov instructions. This prevents you from using ldi for these values and basically frees one of the ALUs. But some of the constants only work if the target is from regfile A as they use pack mode.
Under special conditions you can also assign two different constants to two different targets in one instruction cycle.

Legend: ADD ALU, MUL ALU, both, use pack mode


non-negative small integers negative small integers non-negative float powers of 2 negative (fractional) float powers of 2
Value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 1. 2. 4. 8. 16. 32. 64. 128. /256. /128. /64. /32. /16. /8. /4. /2.
0 xor v8subs
1
or v8min









v8muld v8muld v8muld v8muld













not shr ftoi clz clz clz clz clz clz clz







2
v8adds or v8min

























not

clz ftoi





clz clz clz clz clz clz clz clz
3


or v8min























not
shr
















4

v8adds
or v8min





















not





ftoi












5




or v8min



















not




















6


v8adds

or v8min

















not





















7






or v8min















not



shr

















8

shl
v8adds


or v8min













not










ftoi











9


mul24




or v8min











not
























10




v8adds



or v8min









not

























11










or v8min







not


























12





v8adds




or v8min





not



























13












or v8min



not




























14






v8adds





or v8min

not





























15














or v8min not










shr


















16



mul24


v8adds


























ftoi










18








v8adds





































20









v8adds




































22










v8adds



































24


shl







v8adds


































25




mul24









































26












v8adds

































28







clz clz clz clz clz clz v8adds clz































29



clz clz clz clz







































30

clz clz










v8adds































31
clz
























shr



















32 clz



































ftoi









36





mul24








































49






mul24







































63

























shr




















64



shl


mul24




























ftoi








81








mul24





































100









mul24




































121










mul24



































127
























shr





















128






































ftoi







144











mul24


































160




shl









































169












mul24

































196













mul24
































225














mul24































255























shr






















384





shl








































511






















shr























896






shl







































1023





















shr
























2047




















shr

























2048







shl






































4095



















shr


























4608








shl





































8191


















shr



























10240









shl




































16383

















shr




























22528










shl



































32767
















shr





























49152











shl


































0xffff















shr






























0x1a000












shl

































0x38000













shl
































0x78000














shl































0x1e0000














ror































0x380000













ror
































0x680000












ror

































0xc00000











ror


































0x01010101
or v8min









v8muld v8muld v8muld v8muld













not shr mul24 ftoi clz clz clz clz clz clz clz v8min


fmul


0x01600000










ror



































0x02020202
add v8adds or v8min

























not

clz ftoi





clz clz v8min clz clz clz clz clz clz
0x02800000









ror




































0x03030303


or v8min























not
shr
















0x04040404

add mul24
or v8min





















not

mul24


ftoi






v8min

fmul

0x04800000








ror





































0x05050505




or v8min



















not




















0x06060606


add v8adds

or v8min

















not





















0x07070707






or v8min















not



shr

















0x08000000







ror






































0x08080808

shl
add v8adds


or v8min













not










ftoi






v8min



0x09090909


mul24




or v8min











not





mul24

















0x0a0a0a0a




add v8adds



or v8min









not

























0x0b0b0b0b










or v8min







not


























0x0c0c0c0c





add v8adds




or v8min





not



























0x0d0d0d0d












or v8min



not




























0x0e000000






ror
































v8muld





0x0e0e0e0e






add v8adds





or v8min

not





























0x0e400000







































v8muld
v8muld




0x0f000000










































v8muld
v8muld

0x0f0f0f0f














or v8min not










shr


















0x0f400000











































v8muld
v8muld
0x10000000
































v8muld












v8muld
0x10101010



mul24


add v8adds


















mul24






ftoi






v8min
fmul
0x10400000































v8muld
v8muld












0x11000000


































v8muld
v8muld









0x11400000



































v8muld
v8muld








0x12000000






































v8muld







0x12121212








add v8adds





































0x14141414









add v8adds




































0x16161616










add v8adds



































0x18000000





ror








































0x18181818


shl







add v8adds


































0x19191919




mul24




















mul24



















0x1a1a1a1a












add v8adds

































0x1c1c1c1c







clz clz clz clz clz clz add v8adds clz































0x1d1d1d1d



clz clz clz clz







































0x1e1e1e1e

clz clz










add v8adds































0x1f1f1f1f
clz
























shr



















0x20202020 clz



































ftoi






v8min

0x24242424





mul24


















mul24




















0x28000000




ror









































0x31313131






mul24
















mul24





















1./65536







































fmul






1./16384








































fmul





1./4096









































fmul




1./1024










































fmul



1./256







































or v8min


fmul


1./128







































fadd or v8min





1./64








































fadd or v8min

fmul

1./32









































fadd or v8min



1./16










































fadd or v8min
fmul
1./8











































fadd or v8min

1./4












































fadd or v8min fmul
1./2













































fadd or v8min
0x3f3f3f3f

























shr




















1.0
itof





























or v8min













fadd
2.0

itof




























fadd or v8min













3.0


itof











































0x40404040



shl


mul24














mul24












ftoi






v8min fmul
4.0



itof



























fadd or v8min












5.0




itof









































6.0





itof








































7.0






itof







































8.0







itof
























fadd or v8min











9.0








itof





































10.0









itof




































11.0










itof



































12.0











itof


































13.0












itof

































14.0













itof
































15.0














itof































16.0

































fmul fadd or v8min










32.0



































fadd or v8min









64.0


































fmul
fadd or v8min








128.0





































fadd or v8min







256.0



































fmul

fadd







1024.0




































fmul









4096.0





































fmul








16384.0






































fmul







0x4e6e0000







































itof






0x4e700000








































itof





0x4e720000









































itof




0x4e740000










































itof



0x4e760000











































itof


0x4e780000












































itof

0x4e7a0000













































itof
0x4e7c0000














































itof
0x4e7e0000































itof














0x4e800000
































itof













0x4e810000

































itof












0x4e820000


































itof











0x4e830000



































itof










0x4e840000




































itof









0x4e850000





































itof








0x4e860000






































itof







0x51515151








mul24












mul24























0x60000000


ror











































0x64646464









mul24










mul24
























0x76ff0000







































v8adds






0x77000000







































add






0x78000000








































v8adds





0x78ff0000









































v8adds




0x79000000









































add




0x79797979










mul24








mul24

























0x7a000000










































v8adds



0x7aff0000











































v8adds


0x7b000000











































add


0x7c000000












































v8adds

0x7cff0000













































v8adds
0x7d000000













































add
0x7e000000














































v8adds
0x7eff0000































v8adds














0x7f000000































add














0x7f7f7f7f
























shr
ror



















0x7f800000 NaN















fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul fsub fmul















0x7fffffff
































add add add add add add add







0x80000000
ror



























shl

v8adds













0x80808080





shl shl






























ftoi






v8min
0x80ff0000

































v8adds












0x81000000

































add












0x82000000


































v8adds











0x82ff0000



































v8adds










0x83000000



































add










0x84000000




































v8adds









0x84ff0000





































v8adds








0x85000000





































add








0x86000000






































v8adds







0x90909090











mul24






mul24


























0xa0000000




























shl

















0xa0a0a0a0




shl









































0xa9a9a9a9












mul24




mul24



























0xbcffffff






































not







0xbd7fffff





































not








0xbdffffff




































not









0xbe7fffff



































not










0xbeffffff


































not











0xbf7fffff

































not












-1.0






























itof















0xbfffffff
































not













-2.0 0xc0000000



























shl
itof
















-3.0




























itof

















0xc07fffff































not














-4.0



























itof


















-5.0


























itof



















-6.0

























itof




















-7.0
























itof





















0xc0ffffff














































not
-8.0























itof






















-9.0






















itof























-10.0





















itof
























-11.0




















itof

























-12.0



















itof


























-13.0


















itof



























-14.0

















itof




























-15.0
















itof





























0xc17fffff













































not
-16.0















itof






























0xc1ffffff












































not

0xc27fffff











































not


0xc2ffffff










































not



0xc37fffff









































not




0xc3ffffff








































not





0xc4c4c4c4













mul24


mul24




























0xc47fffff







































not






0xcfcfcfcf



























ror


















0xd8000000


























shl



















0xe0000100















mul24






























0xe0e0e0e0















add






























0xe1e1e1e1














mul24
mul24





























0xe20000e1
















mul24





























0xe2e2e2e2















v8muld add





























0xe40000c4

















mul24




























0xe4e4e4e4
















v8muld add




























0xe60000a9


















mul24



























0xe6e6e6e6

















v8muld add



























0xe8000000

























shl




















0xe8000090



















mul24


























0xe8e8e8e8


















v8muld add


























0xe9e9e9e9



















v8muld


























0xea000079




















mul24

























0xeaeaeaea




















add

























0xebebebeb




















v8muld

























0xec000064





















mul24
























0xecececec





















add
























0xedededed





















mul24
























0xee000051






















mul24























0xeeeeeeee






















add























0xefefefef






















mul24




ror

















0xf0000040























mul24






















0xf0f0f0f0














not or v8min






add






















0xf1f1f1f1













not

or v8min





v8muld






















0xf2000000
























shl





















0xf2000031
























mul24





















0xf2f2f2f2












not



or v8min





add





















0xf3f3f3f3











not





or v8min




v8muld





















0xf4000024

























mul24




















0xf4f4f4f4










not







or v8min




add




















0xf5f5f5f5









not









or v8min



v8muld




















0xf6000019


























mul24



















0xf6f6f6f6








not











or v8min



add



















0xf7f7f7f7







not













or v8min


v8muld



















0xf8000000























shl






















0xf8000010



























mul24


















0xf8f8f8f8






not















or v8min


add


















0xf9f9f9f9





not

















or v8min

v8muld


















0xfa000009




























mul24

















0xfafafafa




not



















or v8min

add

















0xfb800000






















shl























0xfbfbfbfb



not





















or v8min
v8muld ror
















0cfc000004





























mul24
















0xfcfcfcfc


not























or v8min
add
















0xfd800000





















shl
























0xfdfdfdfd

not

























or v8min v8muld
















0xfe000001






























mul24















0xfea00000




















shl

























0xfefefefe
not



























or v8min add















0xff400000



















shl


























0xff800000
NaN
















fadd fadd fadd fadd fadd fadd fadd fadd fadd fadd fadd fadd fadd fadd fadd fadd















0xff980000


















shl



























0xffc80000

















shl




























0xffe20000
















shl





























0xfff00000















shl






























0xfff0ffff















ror






























0xfff8ffff
















ror





























0xfffcbfff

















ror




























0xfffe7fff


















ror



























0xffff4fff



















ror


























0xffffafff




















ror

























0xffffdbff





















ror
























0xffffefff






















ror























0xfffff8ff























ror






















0xfffffcff
























ror





















0xfffffebf

























ror




















-127


























ror



















-49



























ror


















-32















add






























-30















v8muld add





























-28
















v8muld add




























-26

















v8muld add



























-24


















v8muld add


























-23



















v8muld


























-22




















add

























-21




















v8muld

























-20





















add
























-19





















v8muld
























-18






















add























-17






















v8muld




ror

















-16














not or v8min






add






















-15













not

or v8min





























-14












not



or v8min





add





















-13











not





or v8min



























-12










not







or v8min




add




















-11









not









or v8min

























-10








not











or v8min



add



















-9







not













or v8min























-8






not















or v8min


add


















-7





not

















or v8min





















-6




not



















or v8min

add

















-5



not





















or v8min

ror
















-4


not























or v8min
add
















-3

not

























or v8min

















-2
not



























or v8min add















-1 not itof itof itof itof itof itof itof itof itof itof itof itof itof itof itof v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds v8adds or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min or v8min