1
2.. _gmir-opcodes:
3
4Generic Opcodes
5===============
6
7.. contents::
8   :local:
9
10.. note::
11
12  This documentation does not yet fully account for vectors. Many of the
13  scalar/integer/floating-point operations can also take vectors.
14
15Constants
16---------
17
18G_IMPLICIT_DEF
19^^^^^^^^^^^^^^
20
21An undefined value.
22
23.. code-block:: none
24
25  %0:_(s32) = G_IMPLICIT_DEF
26
27G_CONSTANT
28^^^^^^^^^^
29
30An integer constant.
31
32.. code-block:: none
33
34  %0:_(s32) = G_CONSTANT i32 1
35
36G_FCONSTANT
37^^^^^^^^^^^
38
39A floating point constant.
40
41.. code-block:: none
42
43  %0:_(s32) = G_FCONSTANT float 1.0
44
45G_FRAME_INDEX
46^^^^^^^^^^^^^
47
48The address of an object in the stack frame.
49
50.. code-block:: none
51
52  %1:_(p0) = G_FRAME_INDEX %stack.0.ptr0
53
54G_GLOBAL_VALUE
55^^^^^^^^^^^^^^
56
57The address of a global value.
58
59.. code-block:: none
60
61  %0(p0) = G_GLOBAL_VALUE @var_local
62
63G_BLOCK_ADDR
64^^^^^^^^^^^^
65
66The address of a basic block.
67
68.. code-block:: none
69
70  %0:_(p0) = G_BLOCK_ADDR blockaddress(@test_blockaddress, %ir-block.block)
71
72Integer Extension and Truncation
73--------------------------------
74
75G_ANYEXT
76^^^^^^^^
77
78Extend the underlying scalar type of an operation, leaving the high bits
79unspecified.
80
81.. code-block:: none
82
83  %1:_(s32) = G_ANYEXT %0:_(s16)
84
85G_SEXT
86^^^^^^
87
88Sign extend the underlying scalar type of an operation, copying the sign bit
89into the newly-created space.
90
91.. code-block:: none
92
93  %1:_(s32) = G_SEXT %0:_(s16)
94
95G_SEXT_INREG
96^^^^^^^^^^^^
97
98Sign extend the value from an arbitrary bit position, copying the sign bit
99into all bits above it. This is equivalent to a shl + ashr pair with an
100appropriate shift amount. $sz is an immediate (MachineOperand::isImm()
101returns true) to allow targets to have some bitwidths legal and others
102lowered. This opcode is particularly useful if the target has sign-extension
103instructions that are cheaper than the constituent shifts as the optimizer is
104able to make decisions on whether it's better to hang on to the G_SEXT_INREG
105or to lower it and optimize the individual shifts.
106
107.. code-block:: none
108
109  %1:_(s32) = G_SEXT_INREG %0:_(s32), 16
110
111G_ZEXT
112^^^^^^
113
114Zero extend the underlying scalar type of an operation, putting zero bits
115into the newly-created space.
116
117.. code-block:: none
118
119  %1:_(s32) = G_ZEXT %0:_(s16)
120
121G_TRUNC
122^^^^^^^
123
124Truncate the underlying scalar type of an operation. This is equivalent to
125G_EXTRACT for scalar types, but acts elementwise on vectors.
126
127.. code-block:: none
128
129  %1:_(s16) = G_TRUNC %0:_(s32)
130
131Type Conversions
132----------------
133
134G_INTTOPTR
135^^^^^^^^^^
136
137Convert an integer to a pointer.
138
139.. code-block:: none
140
141  %1:_(p0) = G_INTTOPTR %0:_(s32)
142
143G_PTRTOINT
144^^^^^^^^^^
145
146Convert a pointer to an integer.
147
148.. code-block:: none
149
150  %1:_(s32) = G_PTRTOINT %0:_(p0)
151
152G_BITCAST
153^^^^^^^^^
154
155Reinterpret a value as a new type. This is usually done without
156changing any bits but this is not always the case due a subtlety in the
157definition of the :ref:`LLVM-IR Bitcast Instruction <i_bitcast>`. It
158is allowed to bitcast between pointers with the same size, but
159different address spaces.
160
161.. code-block:: none
162
163  %1:_(s64) = G_BITCAST %0:_(<2 x s32>)
164
165G_ADDRSPACE_CAST
166^^^^^^^^^^^^^^^^
167
168Convert a pointer to an address space to a pointer to another address space.
169
170.. code-block:: none
171
172  %1:_(p1) = G_ADDRSPACE_CAST %0:_(p0)
173
174.. caution::
175
176  :ref:`i_addrspacecast` doesn't mention what happens if the cast is simply
177  invalid (i.e. if the address spaces are disjoint).
178
179Scalar Operations
180-----------------
181
182G_EXTRACT
183^^^^^^^^^
184
185Extract a register of the specified size, starting from the block given by
186index. This will almost certainly be mapped to sub-register COPYs after
187register banks have been selected.
188
189G_INSERT
190^^^^^^^^
191
192Insert a smaller register into a larger one at the specified bit-index.
193
194G_MERGE_VALUES
195^^^^^^^^^^^^^^
196
197Concatenate multiple registers of the same size into a wider register.
198The input operands are always ordered from lowest bits to highest:
199
200.. code-block:: none
201
202  %0:(s32) = G_MERGE_VALUES %bits_0_7:(s8), %bits_8_15:(s8),
203                            %bits_16_23:(s8), %bits_24_31:(s8)
204
205G_UNMERGE_VALUES
206^^^^^^^^^^^^^^^^
207
208Extract multiple registers of the specified size, starting from blocks given by
209indexes. This will almost certainly be mapped to sub-register COPYs after
210register banks have been selected.
211The output operands are always ordered from lowest bits to highest:
212
213.. code-block:: none
214
215  %bits_0_7:(s8), %bits_8_15:(s8),
216      %bits_16_23:(s8), %bits_24_31:(s8) = G_UNMERGE_VALUES %0:(s32)
217
218G_BSWAP
219^^^^^^^
220
221Reverse the order of the bytes in a scalar.
222
223.. code-block:: none
224
225  %1:_(s32) = G_BSWAP %0:_(s32)
226
227G_BITREVERSE
228^^^^^^^^^^^^
229
230Reverse the order of the bits in a scalar.
231
232.. code-block:: none
233
234  %1:_(s32) = G_BITREVERSE %0:_(s32)
235
236G_SBFX, G_UBFX
237^^^^^^^^^^^^^^
238
239Extract a range of bits from a register.
240
241The source operands are registers as follows:
242
243- Source
244- The least-significant bit for the extraction
245- The width of the extraction
246
247G_SBFX sign-extends the result, while G_UBFX zero-extends the result.
248
249.. code-block:: none
250
251  ; Extract 5 bits starting at bit 1 from %x and store them in %a.
252  ; Sign-extend the result.
253  ;
254  ; Example:
255  ; %x = 0...0000[10110]1 ---> %a = 1...111111[10110]
256  %lsb_one = G_CONSTANT i32 1
257  %width_five = G_CONSTANT i32 5
258  %a:_(s32) = G_SBFX %x, %lsb_one, %width_five
259
260  ; Extract 3 bits starting at bit 2 from %x and store them in %b. Zero-extend
261  ; the result.
262  ;
263  ; Example:
264  ; %x = 1...11111[100]11 ---> %b = 0...00000[100]
265  %lsb_two = G_CONSTANT i32 2
266  %width_three = G_CONSTANT i32 3
267  %b:_(s32) = G_UBFX %x, %lsb_two, %width_three
268
269Integer Operations
270-------------------
271
272G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR, G_SDIV, G_UDIV, G_SREM, G_UREM
273^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274
275These each perform their respective integer arithmetic on a scalar.
276
277.. code-block:: none
278
279  %2:_(s32) = G_ADD %0:_(s32), %1:_(s32)
280
281G_SDIVREM, G_UDIVREM
282^^^^^^^^^^^^^^^^^^^^
283
284Perform integer division and remainder thereby producing two results.
285
286.. code-block:: none
287
288  %div:_(s32), %rem:_(s32) = G_SDIVREM %0:_(s32), %1:_(s32)
289
290G_SADDSAT, G_UADDSAT, G_SSUBSAT, G_USUBSAT, G_SSHLSAT, G_USHLSAT
291^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
292
293Signed and unsigned addition, subtraction and left shift with saturation.
294
295.. code-block:: none
296
297  %2:_(s32) = G_SADDSAT %0:_(s32), %1:_(s32)
298
299G_SHL, G_LSHR, G_ASHR
300^^^^^^^^^^^^^^^^^^^^^
301
302Shift the bits of a scalar left or right inserting zeros (sign-bit for G_ASHR).
303
304G_ROTR, G_ROTL
305^^^^^^^^^^^^^^
306
307Rotate the bits right (G_ROTR) or left (G_ROTL).
308
309G_ICMP
310^^^^^^
311
312Perform integer comparison producing non-zero (true) or zero (false). It's
313target specific whether a true value is 1, ~0U, or some other non-zero value.
314
315G_SELECT
316^^^^^^^^
317
318Select between two values depending on a zero/non-zero value.
319
320.. code-block:: none
321
322  %5:_(s32) = G_SELECT %4(s1), %6, %2
323
324G_PTR_ADD
325^^^^^^^^^
326
327Add a scalar offset in addressible units to a pointer. Addressible units are
328typically bytes but this may vary between targets.
329
330.. code-block:: none
331
332  %1:_(p0) = G_PTR_ADD %0:_(p0), %1:_(s32)
333
334.. caution::
335
336  There are currently no in-tree targets that use this with addressable units
337  not equal to 8 bit.
338
339G_PTRMASK
340^^^^^^^^^^
341
342Zero out an arbitrary mask of bits of a pointer. The mask type must be
343an integer, and the number of vector elements must match for all
344operands. This corresponds to `i_intr_llvm_ptrmask`.
345
346.. code-block:: none
347
348  %2:_(p0) = G_PTRMASK %0, %1
349
350G_SMIN, G_SMAX, G_UMIN, G_UMAX
351^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
352
353Take the minimum/maximum of two values.
354
355.. code-block:: none
356
357  %5:_(s32) = G_SMIN %6, %2
358
359G_ABS
360^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
361
362Take the absolute value of a signed integer. The absolute value of the minimum
363negative value (e.g. the 8-bit value `0x80`) is defined to be itself.
364
365.. code-block:: none
366
367  %1:_(s32) = G_ABS %0
368
369G_UADDO, G_SADDO, G_USUBO, G_SSUBO, G_SMULO, G_UMULO
370^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
371
372Perform the requested arithmetic and produce a carry output in addition to the
373normal result.
374
375.. code-block:: none
376
377  %3:_(s32), %4:_(s1) = G_UADDO %0, %1
378
379G_UADDE, G_SADDE, G_USUBE, G_SSUBE
380^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
381
382Perform the requested arithmetic and consume a carry input in addition to the
383normal input. Also produce a carry output in addition to the normal result.
384
385.. code-block:: none
386
387  %4:_(s32), %5:_(s1) = G_UADDE %0, %1, %3:_(s1)
388
389G_UMULH, G_SMULH
390^^^^^^^^^^^^^^^^
391
392Multiply two numbers at twice the incoming bit width (signed) and return
393the high half of the result.
394
395.. code-block:: none
396
397  %3:_(s32) = G_UMULH %0, %1
398
399G_CTLZ, G_CTTZ, G_CTPOP
400^^^^^^^^^^^^^^^^^^^^^^^
401
402Count leading zeros, trailing zeros, or number of set bits.
403
404.. code-block:: none
405
406  %2:_(s33) = G_CTLZ_ZERO_UNDEF %1
407  %2:_(s33) = G_CTTZ_ZERO_UNDEF %1
408  %2:_(s33) = G_CTPOP %1
409
410G_CTLZ_ZERO_UNDEF, G_CTTZ_ZERO_UNDEF
411^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
412
413Count leading zeros or trailing zeros. If the value is zero then the result is
414undefined.
415
416.. code-block:: none
417
418  %2:_(s33) = G_CTLZ_ZERO_UNDEF %1
419  %2:_(s33) = G_CTTZ_ZERO_UNDEF %1
420
421Floating Point Operations
422-------------------------
423
424G_FCMP
425^^^^^^
426
427Perform floating point comparison producing non-zero (true) or zero
428(false). It's target specific whether a true value is 1, ~0U, or some other
429non-zero value.
430
431G_FNEG
432^^^^^^
433
434Floating point negation.
435
436G_FPEXT
437^^^^^^^
438
439Convert a floating point value to a larger type.
440
441G_FPTRUNC
442^^^^^^^^^
443
444Convert a floating point value to a narrower type.
445
446G_FPTOSI, G_FPTOUI, G_SITOFP, G_UITOFP
447^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
448
449Convert between integer and floating point.
450
451G_FABS
452^^^^^^
453
454Take the absolute value of a floating point value.
455
456G_FCOPYSIGN
457^^^^^^^^^^^
458
459Copy the value of the first operand, replacing the sign bit with that of the
460second operand.
461
462G_FCANONICALIZE
463^^^^^^^^^^^^^^^
464
465See :ref:`i_intr_llvm_canonicalize`.
466
467G_FMINNUM
468^^^^^^^^^
469
470Perform floating-point minimum on two values.
471
472In the case where a single input is a NaN (either signaling or quiet),
473the non-NaN input is returned.
474
475The return value of (FMINNUM 0.0, -0.0) could be either 0.0 or -0.0.
476
477G_FMAXNUM
478^^^^^^^^^
479
480Perform floating-point maximum on two values.
481
482In the case where a single input is a NaN (either signaling or quiet),
483the non-NaN input is returned.
484
485The return value of (FMAXNUM 0.0, -0.0) could be either 0.0 or -0.0.
486
487G_FMINNUM_IEEE
488^^^^^^^^^^^^^^
489
490Perform floating-point minimum on two values, following the IEEE-754 2008
491definition. This differs from FMINNUM in the handling of signaling NaNs. If one
492input is a signaling NaN, returns a quiet NaN.
493
494G_FMAXNUM_IEEE
495^^^^^^^^^^^^^^
496
497Perform floating-point maximum on two values, following the IEEE-754 2008
498definition. This differs from FMAXNUM in the handling of signaling NaNs. If one
499input is a signaling NaN, returns a quiet NaN.
500
501G_FMINIMUM
502^^^^^^^^^^
503
504NaN-propagating minimum that also treat -0.0 as less than 0.0. While
505FMINNUM_IEEE follow IEEE 754-2008 semantics, FMINIMUM follows IEEE 754-2018
506draft semantics.
507
508G_FMAXIMUM
509^^^^^^^^^^
510
511NaN-propagating maximum that also treat -0.0 as less than 0.0. While
512FMAXNUM_IEEE follow IEEE 754-2008 semantics, FMAXIMUM follows IEEE 754-2018
513draft semantics.
514
515G_FADD, G_FSUB, G_FMUL, G_FDIV, G_FREM
516^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
517
518Perform the specified floating point arithmetic.
519
520G_FMA
521^^^^^
522
523Perform a fused multiply add (i.e. without the intermediate rounding step).
524
525G_FMAD
526^^^^^^
527
528Perform a non-fused multiply add (i.e. with the intermediate rounding step).
529
530G_FPOW
531^^^^^^
532
533Raise the first operand to the power of the second.
534
535G_FEXP, G_FEXP2
536^^^^^^^^^^^^^^^
537
538Calculate the base-e or base-2 exponential of a value
539
540G_FLOG, G_FLOG2, G_FLOG10
541^^^^^^^^^^^^^^^^^^^^^^^^^
542
543Calculate the base-e, base-2, or base-10 respectively.
544
545G_FCEIL, G_FCOS, G_FSIN, G_FSQRT, G_FFLOOR, G_FRINT, G_FNEARBYINT
546^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
547
548These correspond to the standard C functions of the same name.
549
550G_INTRINSIC_TRUNC
551^^^^^^^^^^^^^^^^^
552
553Returns the operand rounded to the nearest integer not larger in magnitude than the operand.
554
555G_INTRINSIC_ROUND
556^^^^^^^^^^^^^^^^^
557
558Returns the operand rounded to the nearest integer.
559
560Vector Specific Operations
561--------------------------
562
563G_CONCAT_VECTORS
564^^^^^^^^^^^^^^^^
565
566Concatenate two vectors to form a longer vector.
567
568G_BUILD_VECTOR, G_BUILD_VECTOR_TRUNC
569^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
570
571Create a vector from multiple scalar registers. No implicit
572conversion is performed (i.e. the result element type must be the
573same as all source operands)
574
575The _TRUNC version truncates the larger operand types to fit the
576destination vector elt type.
577
578G_INSERT_VECTOR_ELT
579^^^^^^^^^^^^^^^^^^^
580
581Insert an element into a vector
582
583G_EXTRACT_VECTOR_ELT
584^^^^^^^^^^^^^^^^^^^^
585
586Extract an element from a vector
587
588G_SHUFFLE_VECTOR
589^^^^^^^^^^^^^^^^
590
591Concatenate two vectors and shuffle the elements according to the mask operand.
592The mask operand should be an IR Constant which exactly matches the
593corresponding mask for the IR shufflevector instruction.
594
595Vector Reduction Operations
596---------------------------
597
598These operations represent horizontal vector reduction, producing a scalar result.
599
600G_VECREDUCE_SEQ_FADD, G_VECREDUCE_SEQ_FMUL
601^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
602
603The SEQ variants perform reductions in sequential order. The first operand is
604an initial scalar accumulator value, and the second operand is the vector to reduce.
605
606G_VECREDUCE_FADD, G_VECREDUCE_FMUL
607^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
608
609These reductions are relaxed variants which may reduce the elements in any order.
610
611G_VECREDUCE_FMAX, G_VECREDUCE_FMIN
612^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
613
614FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
615
616
617Integer/bitwise reductions
618^^^^^^^^^^^^^^^^^^^^^^^^^^
619
620* G_VECREDUCE_ADD
621* G_VECREDUCE_MUL
622* G_VECREDUCE_AND
623* G_VECREDUCE_OR
624* G_VECREDUCE_XOR
625* G_VECREDUCE_SMAX
626* G_VECREDUCE_SMIN
627* G_VECREDUCE_UMAX
628* G_VECREDUCE_UMIN
629
630Integer reductions may have a result type larger than the vector element type.
631However, the reduction is performed using the vector element type and the value
632in the top bits is unspecified.
633
634Memory Operations
635-----------------
636
637G_LOAD, G_SEXTLOAD, G_ZEXTLOAD
638^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
639
640Generic load. Expects a MachineMemOperand in addition to explicit
641operands. If the result size is larger than the memory size, the
642high bits are undefined, sign-extended, or zero-extended respectively.
643
644Only G_LOAD is valid if the result is a vector type. If the result is larger
645than the memory size, the high elements are undefined (i.e. this is not a
646per-element, vector anyextload)
647
648G_INDEXED_LOAD
649^^^^^^^^^^^^^^
650
651Generic indexed load. Combines a GEP with a load. $newaddr is set to $base + $offset.
652If $am is 0 (post-indexed), then the value is loaded from $base; if $am is 1 (pre-indexed)
653then the value is loaded from $newaddr.
654
655G_INDEXED_SEXTLOAD
656^^^^^^^^^^^^^^^^^^
657
658Same as G_INDEXED_LOAD except that the load performed is sign-extending, as with G_SEXTLOAD.
659
660G_INDEXED_ZEXTLOAD
661^^^^^^^^^^^^^^^^^^
662
663Same as G_INDEXED_LOAD except that the load performed is zero-extending, as with G_ZEXTLOAD.
664
665G_STORE
666^^^^^^^
667
668Generic store. Expects a MachineMemOperand in addition to explicit
669operands. If the stored value size is greater than the memory size,
670the high bits are implicitly truncated. If this is a vector store, the
671high elements are discarded (i.e. this does not function as a per-lane
672vector, truncating store)
673
674G_INDEXED_STORE
675^^^^^^^^^^^^^^^
676
677Combines a store with a GEP. See description of G_INDEXED_LOAD for indexing behaviour.
678
679G_ATOMIC_CMPXCHG_WITH_SUCCESS
680^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
681
682Generic atomic cmpxchg with internal success check. Expects a
683MachineMemOperand in addition to explicit operands.
684
685G_ATOMIC_CMPXCHG
686^^^^^^^^^^^^^^^^
687
688Generic atomic cmpxchg. Expects a MachineMemOperand in addition to explicit
689operands.
690
691G_ATOMICRMW_XCHG, G_ATOMICRMW_ADD, G_ATOMICRMW_SUB, G_ATOMICRMW_AND, G_ATOMICRMW_NAND, G_ATOMICRMW_OR, G_ATOMICRMW_XOR, G_ATOMICRMW_MAX, G_ATOMICRMW_MIN, G_ATOMICRMW_UMAX, G_ATOMICRMW_UMIN, G_ATOMICRMW_FADD, G_ATOMICRMW_FSUB
692^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
693
694Generic atomicrmw. Expects a MachineMemOperand in addition to explicit
695operands.
696
697G_FENCE
698^^^^^^^
699
700.. caution::
701
702  I couldn't find any documentation on this at the time of writing.
703
704Control Flow
705------------
706
707G_PHI
708^^^^^
709
710Implement the φ node in the SSA graph representing the function.
711
712.. code-block:: none
713
714  %1(s8) = G_PHI %7(s8), %bb.0, %3(s8), %bb.1
715
716G_BR
717^^^^
718
719Unconditional branch
720
721G_BRCOND
722^^^^^^^^
723
724Conditional branch
725
726G_BRINDIRECT
727^^^^^^^^^^^^
728
729Indirect branch
730
731G_BRJT
732^^^^^^
733
734Indirect branch to jump table entry
735
736G_JUMP_TABLE
737^^^^^^^^^^^^
738
739.. caution::
740
741  I found no documentation for this instruction at the time of writing.
742
743G_INTRINSIC, G_INTRINSIC_W_SIDE_EFFECTS
744^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
745
746Call an intrinsic
747
748The _W_SIDE_EFFECTS version is considered to have unknown side-effects and
749as such cannot be reordered across other side-effecting instructions.
750
751.. note::
752
753  Unlike SelectionDAG, there is no _VOID variant. Both of these are permitted
754  to have zero, one, or multiple results.
755
756Variadic Arguments
757------------------
758
759G_VASTART
760^^^^^^^^^
761
762.. caution::
763
764  I found no documentation for this instruction at the time of writing.
765
766G_VAARG
767^^^^^^^
768
769.. caution::
770
771  I found no documentation for this instruction at the time of writing.
772
773Other Operations
774----------------
775
776G_DYN_STACKALLOC
777^^^^^^^^^^^^^^^^
778
779Dynamically realigns the stack pointer to the specified size and alignment.
780An alignment value of `0` or `1` means no specific alignment.
781
782.. code-block:: none
783
784  %8:_(p0) = G_DYN_STACKALLOC %7(s64), 32
785
786Optimization Hints
787------------------
788
789These instructions do not correspond to any target instructions. They act as
790hints for various combines.
791
792G_ASSERT_SEXT, G_ASSERT_ZEXT
793^^^^^^^^^^^^^^^^^^^^^^^^^^^^
794
795This signifies that the contents of a register were previously extended from a
796smaller type.
797
798The smaller type is denoted using an immediate operand. For scalars, this is the
799width of the entire smaller type. For vectors, this is the width of the smaller
800element type.
801
802.. code-block:: none
803
804  %x_was_zexted:_(s32) = G_ASSERT_ZEXT %x(s32), 16
805  %y_was_zexted:_(<2 x s32>) = G_ASSERT_ZEXT %y(<2 x s32>), 16
806
807  %z_was_sexted:_(s32) = G_ASSERT_SEXT %z(s32), 8
808
809G_ASSERT_SEXT and G_ASSERT_ZEXT act like copies, albeit with some restrictions.
810
811The source and destination registers must
812
813- Be virtual
814- Belong to the same register class
815- Belong to the same register bank
816
817It should always be safe to
818
819- Look through the source register
820- Replace the destination register with the source register
821