source: CLRX/CLRadeonExtender/trunk/doc/ClrxAsmPseudoOps.md @ 4102

Last change on this file since 4102 was 4102, checked in by matszpk, 14 months ago

CLRadeonExtender: Asm: Add enums (pseudo-ops '.enum').

File size: 27.1 KB
Line 
1## CLRadeonExtender Assembler Pseudo-Operations
2
3The CLRX assembler accepts the almost pseudo-operations from GNU assembler.
4This chapter lists and explains standard pseudo-operations.
5
6A CLRX assembler stores values greater than byte in the little-endian ordering.
7
8## List of the pseudo-operations
9
10### .32bit
11
12This pseudo-operation should to be at begin of source.
13Choose 32-bit binaries (it have meaningful for the AMD Catalyst and GalliumCompute
14binary format). For AMD Catalyst OpenCL 1.2 and 2.0 format, it determines
15bitness of address. For GalliumCompute, it determines bitness of inner ELF binary.
16For ROCm binary format, bitness is ignored.
17
18### .64bit
19
20This pseudo-operation should to be at begin of source.
21Choose 64-bit binaries (it have meaningful for the AMD Catalyst and GalliumCompute
22binary format). For AMD Catalyst OpenCL 1.2 and 2.0 format, it determines
23bitness of address. For GalliumCompute, it determines bitness of inner ELF binary.
24For ROCm binary format, bitness is ignored.
25
26### .abort
27
28Aborts compilation.
29
30### .align, .balign
31
32Syntax: .align ALIGNMENT[, [VALUE] [, LIMIT]] 
33Syntax: .balign ALIGNMENT[, [VALUE] [, LIMIT]]
34
35Align current position to value of the first expression.
36Value of that expression must be a power of two.
37By default if section is writeable, fill 0's.
38Second expression determines byte value that will be stored inside filling.
39If third expression is not given, assembler accepts any length of the skip.
40Third expression limits skip to own value. If any alignment needs to skip number
41of the bytes greater than that value, then alignment will not be done.
42If aligment will be done in `.text` section and second expresion will not be given, then
43assembler fills no-operation instructions in that hole.
44
45### .altmacro
46
47Enable alternate macro syntax. This mode enables following features:
48
49* new macro substitution without backslash:
50
51```
52.macro test1 a b
53    .int a, b
54.endm
55test1 12,34     # put 12 and 34 integer value
56```
57
58* evaluating expression as string in macro arguments:
59
60```
61.macro stringize a,b,c
62    .string "a, b, c"
63.endm
64stringize %12|33, %43*5, %12-65 # generate string "45, 215, -53"
65```
66
67* new string quoting in macro arguments (by triagular brackets '<' and '>' or by single
68quote ' or double quote "). Also, enables new string escaping by '!'.
69
70```
71test1 <this is test !<!>>  # put "this is test <>" string to first macro argument
72test1 "this is test <>"  # put "this is test <>" string to first macro argument
73test1 'this is test !''  # put "this is test '" string to first macro argument
74```
75
76* local symbol names. 'local name' defines new unique symbol name for name. If any name
77will be occurred then that unique name will substituted.
78
79```
80local myName    # myName substitutes new unique name
81myName:     # define new label with unique name
82```
83
84An alternate macro syntax does not disable any standard macro syntax features likes
85macro substitution via backslashes, '\@'.
86
87### .amd
88
89This pseudo-operation should to be at begin of source.
90Choose AMD Catalyst OpenCL 1.2 program binary format.
91
92### .amdcl2
93
94This pseudo-operation should to be at begin of source.
95Choose AMD Catalyst new (introduced for OpenCL 2.0 support) program binary format.
96
97### .arch
98
99Syntax: .arch ARCHITECTURE
100
101This pseudo-operation should to be at begin of source. Set GPU architecture.
102One of following architecture can be set:
103SI, VI, CI, VEGA, GFX6, GFX7, GFX8, GFX9, GCN1.0, GCN1.1, GCN1.2 and GCN1.4.
104
105### .ascii
106
107Syntax: .ascii "STRING",....
108
109Emit ASCII string. This pseudo-operations does not add the
110null-terminated character. If more than one string will be given then all given
111string will be concatenated.
112
113### .asciz
114
115Syntax: .asciz "STRING",....
116
117Emit ASCII string. This pseudo-operations adds the
118null-terminated character. If more than one string will be given then all given
119string will be concatenated.
120
121### .balignw, .balignl
122
123Syntax: .balignw ALIGNMENT[, [VALUE] [, LIMIT]] 
124Syntax: .balignl ALIGNMENT[, [VALUE] [, LIMIT]]
125
126Refer to `.align`. `.balignw` treats fill value as 2-byte word. `.balignl` treats
127fill value as 4-byte word.
128
129### .buggyfplit
130
131Enable old and buggy behavior for floating point literals and constants.
132
133### .byte
134
135Syntax: .byte ABS-EXPR,....
136
137Emit byte values. If any expression is empty then an assembler stores
1380 and warns about empty expression. If expression will give a value that can not be stored
139in byte then an assembler warn about that.
140
141### .data
142
143Go to `.data` section. If this section doesn't exist assembler create it.
144
145### .double
146
147Syntax: .double DOUBLE-VAL,...
148
149Put double-precision floating point values into current section.
150If no value between comma then an assembler stores 0 and warn about no value.
151This pseudo-operation accepts only double precision floating point literals.
152
153### .else
154
155Part of the if-endif clause. Refer to `.if` pseudo-operation.
156Code between `.else` and `.endif` will be performed if all previous conditions was not
157satisified. Otherwise code will be skipped.
158
159### .elseifXXX
160
161Syntax: .elseif ABS-EXPR 
162Syntax: .elseif32 
163Syntax: .elseif64 
164Syntax: .elseifarch ARCHITECTURE 
165Syntax: .elseifb STRING 
166Syntax: .elseifc STRING1, STRING2 
167Syntax: .elseifdef SYMBOL 
168Syntax: .elseifeq ABS-EXPR 
169Syntax: .elseifeqs "STRING1","STRING2" 
170Syntax: .elseiffmt BINFMT 
171Syntax: .elseifge ABS-EXPR 
172Syntax: .elseifgpu GPUDEVICE 
173Syntax: .elseifgt ABS-EXPR 
174Syntax: .elseifle ABS-EXPR 
175Syntax: .elseiflt ABS-EXPR 
176Syntax: .elseifnarch ARCHITECTURE 
177Syntax: .elseifnb STRING 
178Syntax: .elseifnc STRING1, STRING2 
179Syntax: .elseifndef SYMBOL 
180Syntax: .elseifne ABS-EXPR 
181Syntax: .elseifnes "STRING1","STRING2" 
182Syntax: .elseifnfmt BINFMT 
183Syntax: .elseifngpu GPUDEVICE 
184Syntax: .elseifnotdef SYMBOL
185
186Part of the if-endif clause. Refer to `.if` pseudo-operation.
187Code between `.else` and `.endif` will be performed if all previous conditions was not
188satisified and condition to this pseudo-operation was satisfied. Otherwise code will be
189skipped.
190
191### .end
192
193Ends source code compilation at this point.
194
195### .endif
196
197Finish if-endif clause.
198
199### .endm, .endmacro
200
201Finish macro definition
202
203### .endr, .endrept
204
205Finish code of repetition.
206
207### .ends, .endscope
208
209Close visibility's scope.
210
211### .enum
212
213Syntax: .enum [>STARTPOS,] SYMBOL,....
214
215Simplify defining the enumerations. For every symbol,
216define symbol with value of enumeration counter and increase an enumeration counter.
217Defined symbols can not be assigned later. Optional STARTPOS sets enumeration counter
218to STARTPOS value. Every scope has own enumeration counter. This features simplify
219joining enumerations with scopes.
220
221Examples:
222
223```
224.enum OK,BADFD,FATAL        # define OK=0, BADFD=1, FATAL=2
225.enum >8, BitOne,BitTwo     # define BitOne=8, BitTwo=9
226.enum HALO                  # define HALO=10
227.scope Result
228    # enum counter is zero in this scope
229    .enum NONE,FULL,INVALID   # NONE=0, FULL=1, INVALID=2
230.ends
231```
232
233### .equ, .set
234
235Syntax: .equ SYMBOL, EXPR|REG 
236Syntax: .set SYMBOL, EXPR|REG
237
238Define symbol with specified value of the expression or register or register range
239given in second operand. Symbol defined by using these pseudo-operations can be
240redefined many times.
241
242### .equiv
243
244Syntax: .equiv SYMBOL, EXPR|REG
245
246Define symbol with specified value of the expression or register or register range
247given in second operand given in second operand.
248Symbol defined by using `.equiv` can not be redefined. If symbol was already defined
249this pseudo-operations causes an error.
250
251### .eqv
252
253Syntax: .eqv SYMBOL, EXPR|REG
254
255Define symbol with specified expression or register or register range
256given in second operand given in second operand.
257Symbol defined by using `.eqv` can not be redefined.
258If symbol was already defined this pseudo-operations causes an error.
259The expression of symbol will be evaluated any time when symbol will be used.
260This feature allow to change value of symbol indirectly by changing value of the symbols
261used in expression. Example:
262
263```
264a = 3
265b = 5
266.eqv currentValue, a+b  # now currentValue is equal to 8
267.int currentValue
268b = 7
269.int currentValue  # we changed b to 7, so we put 10
270```
271
272### .err
273
274This pseudo-operation causes error at point where is encountered.
275
276### .error
277
278Syntax: .error "STRING"
279
280This pseudo-operation causes error and print error given in string.
281
282### .exitm
283
284This pseudo-operation can be used only inside macro definitions. It does early exiting
285from macro. Useful while using conditions inside a macros.
286
287### .extern
288
289Syntax: .extern SYMBOL,...
290
291Set symbol as external. Ignored by GNU as and CLRX assembler.
292
293### .fail
294
295Syntax: .fail ABS-EXPR
296
297If value of the expression is greater or equal to 500 then assembler print warnings.
298Otherwise assembler print error and fails.
299
300### .file
301
302This pseudo-operation is ignored by CLRX assembler.
303
304### .fill, .fillq
305
306Syntax: .fill REPEAT[, [SIZE] [, VALUE]] 
307Syntax: .fillq REPEAT[, [SIZE] [, VALUE]]
308
309Emit value many times. First expression defines how many times value will be stored.
310Second expression defines how long is value. Third expression defines value to be stored.
311If second expression is not given, then assembler assumes that is byte value.
312If third expression is not given then assembler stores 0's. Assembler takes only
313lowest 4-bytes of the value, and if size of value is greater than 4 then more significant
314bytes will be assumed to be 0. The `.fillq` takes all bytes of the 64-bit value.
315If value doesn't fit to size of value then it will be truncated.
316Size of value can be 0. First expression too.
317
318### .float, .single
319
320Syntax: .float FLOAT-VAL,... 
321Syntax: .single FLOAT-VAL,...
322
323Emit single-precision floating point values. If no value between comma then an
324assembler stores 0 and warn about no value.
325This pseudo-operation accepts only single precision floating point literals.
326
327### .for
328
329Syntax: .for SYMBOL=INITVALUE, COND-EXPR, NEXT-EXPR
330
331Open 'for' repetition. Before repetition, SYMBOL is initialized by INITVALUE.
332For every repetition SYMBOL value will be replaced by value evaluted by NEXT-EXPR.
333The code between this pseudo-operation and `.endr` will be repeated
334until COND-EXPR returns zero. Example:
335
336```
337.for x=1,x<16,x+x
338    .int x
339.endr
340```
341
342generates:
343
344```
345.int x      # x=1
346.int x      # x=2
347.int x      # x=4
348.int x      # x=8
349```
350
351### .format
352
353Syntax: .format BINFORMAT
354
355This pseudo-operation should to be at begin of source.
356Choose binary format. Binary can be one of following list:
357
358* `amd`, `catalyst` - AMD Catalyst OpenCL 1.2 binary format
359* `amdcl2` - AMD Catalyst new (introduced for OpenCL 2.0) binary format
360* `gallium` - the GalliumCompute binary format
361* `rocm` - the ROCm binary format
362* `raw` - rawcode (raw program instructions)
363
364### .gallium
365
366This pseudo-operation should to be at begin of source.
367Choose GalliumCompute OpenCL program binary format.
368
369### .get_64bit
370
371Syntax: .get_64bit SYMBOL
372
373Store 64-bitness in specified symbol. Store 1 to symbol if 64-bit mode enabled.
374
375### .get_arch
376
377Syntax: .get_arch SYMBOL
378
379Store GPU architecture identifier to symbol. List of architecture ids:
380
381Id | Description
382---|-------------------------------------------
383 0 | GCN1.0 (Pitcairn, Tahiti)
384 1 | GCN1.1 (Bonaire, Hawaii)
385 2 | GCN1.2 (Tonga, Fiji, Ellesmere)
386 3 | VEGA (AMD RX VEGA)
387
388### .get_format
389
390Syntax: .get_format SYMBOL
391
392Store binary format identifier to symbol. List of format ids:
393
394Id | Description
395---|-------------------------------------------
396 0 | AMD OpenCL 1.2 binary format
397 1 | Gallium Compute binary format
398 2 | Raw code
399 3 | AMD OpenCL 2.0 (new driver) binary format
400 4 | ROCm binary format
401
402### .get_gpu
403
404Syntax: .get_gpu SYMBOL
405
406Store GPU device identifier to symbol. List of GPU device ids:
407
408Id  | Description
409----|-------------------------------------------
410 0  | Cape Verde (Radeon HD 7700)
411 1  | Pitcairn (Radeon HD 7850)
412 2  | Tahiti  (Radeon HD 7900)
413 3  | Oland
414 4  | Bonaire  (Radeon R7 260)
415 5  | Spectre
416 6  | Spooky
417 7  | Kalindi
418 8  | Hainan
419 9  | Hawaii (Radeon R9 290)
420 10 | Iceland
421 11 | Tonga (Radeon R9 285)
422 12 | Mullins
423 13 | Fiji (Radeon Fury)
424 14 | Carrizo
425 15 | Dummy
426 16 | Goose
427 17 | Horse
428 18 | Stoney
429 19 | Ellesmere (Radeon RX 470/480)
430 20 | Baffin (Radeon 460)
431 21 | gfx804
432 22 | gfx900 (Radeon RX VEGA)
433 23 | gfx901 (Radeon RX VEGA)
434 24 | gfx902 (Radeon RX VEGA)
435 25 | gfx903 (Radeon RX VEGA)
436 26 | gfx904 (Radeon RX VEGA)
437 27 | gfx905 (Radeon RX VEGA)
438
439### .get_version
440
441Syntax: .get_version SYMBOL
442
443Store CLRadeonExtender version to symbol. Version stored as integer in form:
444`major_version*10000 + minor_version*100 + micro_version`.
445
446### .global, .globl
447
448Syntax: .global SYMBOL,... 
449Syntax: .globl SYMBOL,...
450
451Indicates that symbols will be a global. Global symbol can be used
452across many object files. The CLRX assembler can expose global symbols at output binary if
453adding sybols will be enabled.
454
455### .gpu GPUDEVICE
456
457Syntax: .gpu GPUDEVICE
458
459This pseudo-operation should to be at begin of source. Set GPU device.
460One of following device type can be set:
461CapeVerde, Pitcairn, Tahiti, Oland, Bonaire, Spectre, Spooky, Kalindi,
462Hainan, Hawaii, Iceland, Tonga, Mullins, Fiji, Carrizo, Goose, Horse, Stoney,
463Ellesmere, and Baffin.
464
465### .half
466
467Syntax: .half HALF-VAL,...
468
469Emit half-precision floating point values.
470If no value between comma then an assembler stores 0 and warn about no value.
471This pseudo-operation accepts only half precision floating point literals.
472
473### .hword, .short
474
475Syntax: .hword ABS-EXPR,....
476Syntax: .short ABS-EXPR,....
477
478Emit 2-byte word values. If any expression is empty then an assembler
479stores 0 and warns about empty expression. If expression will give a value that can not be
480stored in 2-byte word then an assembler warn about that.
481
482### .ifXXX
483
484Syntax: .if ABS-EXPR 
485Syntax: .if32 
486Syntax: .if64 
487Syntax: .ifarch ARCHITECTURE 
488Syntax: .ifb STRING 
489Syntax: .ifc STRING1, STRING2 
490Syntax: .ifdef SYMBOL 
491Syntax: .ifeq ABS-EXPR 
492Syntax: .ifeqs "STRING1","STRING2" 
493Syntax: .iffmt BINFMT 
494Syntax: .ifge ABS-EXPR 
495Syntax: .ifgpu GPUDEVICE 
496Syntax: .ifgt ABS-EXPR 
497Syntax: .ifle ABS-EXPR 
498Syntax: .iflt ABS-EXPR 
499Syntax: .ifnarch ARCHITECTURE 
500Syntax: .ifnb STRING 
501Syntax: .ifnc STRING1, STRING2 
502Syntax: .ifndef SYMBOL 
503Syntax: .ifne ABS-EXPR 
504Syntax: .ifnes "STRING1","STRING2" 
505Syntax: .ifnfmt BINFMT 
506Syntax: .ifngpu GPUDEVICE 
507Syntax: .ifnotdef SYMBOL
508
509Open if-endif clause. After that pseudo-op can encounter `.elseifXX` or `.else`
510pseudo-operations. If condition of that pseudo-operations is satisfied then
511code will be performed.
512
513List of the `.if` kinds:
514
515* `.if` - perform code if value is not zero.
516* `.if32` - perform code if 32-bit binary.
517* `.if64` - perform code if 64-bit binary.
518* `.ifarch` - perform code if specified architecture was set.
519* `.ifb` - perform code if all character after name of this pseudo-op is blank.
520* `.ifc` - compare two unquoted strings. If are equal then perform code.
521* `.ifdef` - perform code if symbol was defined
522* `.ifeq` - perform code if value is zero.
523* `.ifeqs` - perform code if two quoted string are equal.
524* `.iffmt` - perform code if specified binary format was set.
525* `.ifge` - perform code if value is greater or equal to zero.
526* `.ifgpu` - perform code if specified GPU device type was set.
527* `.ifgt` - perform code if value is greater than zero.
528* `.ifle` - perform code if value is less or equal to zero.
529* `.iflt` - perform code if value is less than zero.
530* `.ifnarch` - perform code if specified architecture was not set.
531* `.ifnb` - perform code if any character after name of this pseudo-op is not blank.
532* `.ifnc` - compare two unquoted strings. If are not equal then perform code.
533* `.ifndef` - perform code if symbol was not defined.
534* `.ifne` - perform code if value is not zero.
535* `.ifnes` - perform code if two quoted string are not equal.
536* `.ifnfmt` - perform code if specified binary format was not set.
537* `.ifngpu` - perform code if specified GPU device type was not set.
538* `.ifnotdef` - perform code if symbol was not defined.
539
540### .incbin
541
542Syntax: .incbin FILENAME[, [OFFSET] [, COUNT]]
543
544Append the binary file into currenct section. If file not found in the current directory
545then assembler searches file in the include paths. If file not found again then assembler
546prints error. Second optional argument defines offset (how many bytes should to be skipped).
547By default assembler begin appending from first byte.
548Third argument defines maximum number bytes to append. By default all data from binary
549will be appended.
550
551### .include
552
553Syntax: .include "FILENAME"
554
555Include new source code file and begins assemblying from this file.
556An assembler automatically returns to previous file if encounters end of the that file.
557If file not found in the current directory then assembler searches file in the
558include paths. If file not found again then assembler prints error.
559
560### .irp
561
562Syntax: .irp NAME, STRING,... 
563Syntax: .irp NAME STRING ...
564
565Begin repetition with the named variable. Nth occurrence of name will be replaced by
566nth string. The name of variable must be preceded by `\` character.
567
568Sample usage:
569
570```
571.irp reg v0,v1,v4,v5
572    v_mul_f32 v10,\reg
573.endr
574```
575
576produces:
577
578```
579    v_mul_f32 v10,v0
580    v_mul_f32 v10,v1
581    v_mul_f32 v10,v4
582    v_mul_f32 v10,v5
583```
584
585Alternate syntax does not require a comma separator between strings and variable name.
586Rules regarding to substituting variables are same as in macro substitution. Refer to
587`.macro` pseudo-operation.
588
589### .irpc
590
591Syntax: .irpc NAME, STRING
592
593Begin repetition with the named variable.Nth occurrence of name will be replaced by
594nth character of the string (second operand).
595The name of variable must be preceded by `\` character.
596
597```
598.irp reg 0145
599    v_mul_f32 v10,v\reg
600.endr
601```
602
603produces:
604
605```
606    v_mul_f32 v10,v0
607    v_mul_f32 v10,v1
608    v_mul_f32 v10,v4
609    v_mul_f32 v10,v5
610```
611
612Rules regarding to substituting variables are same as in macro substitution. Refer to
613`.macro` pseudo-operation.
614
615### .int, .long
616
617Syntax: .int ABS-EXPR,.... 
618Syntax: .long ABS-EXPR,....
619
620Emit 4-byte word values. If any expression is empty then an assembler
621stores 0 and warns about empty expression. If expression will give a value that can not be
622stored in 4-byte word then an assembler warn about that.
623
624### .kernel
625
626Syntax: .kernel KERNELNAME
627
628Create new kernel with default section or move to an existing kernel and
629its default section. Types of section which can to be belonging to kernel depends on
630the binary format.
631
632### .lflags
633
634This pseudo-operation is ignored by CLRX assembler.
635
636### .ln, .line
637
638These pseudo-operations are ignored by CLRX assembler.
639
640### .local
641
642Syntax: .local SYMBOL,...
643
644Indicates that symbols will be a local. Local symbol are not visible in other
645binary objects and they can be used only locally.
646
647### .macro
648
649Syntax: .macro MACRONAME, ARG,... 
650Syntax: .macro MACRONAME ARG ...
651
652Begin macro definition. The macro is recorded code that can be used later in source code.
653Macro can accepts one or more arguments that will be substituted in its body.
654Occurrence of the argument must be preceded by `\` character.
655
656Special case of substitution is `\@` that replaced by number of the macro substitution.
657Sometimes substitution must be joined with other name. In this case '\()` can be used to
658split argument occurrence and other name. Example:
659
660```
661.macro macro1, x
662.set \x\()Symbol, 10 # set symbol Xsymbol to value 10
663.endm
664macro1 Linux # define LinuxSymbol=10
665```
666
667That substitution is useful to create labels and symbols that can not be redefined.
668Value of the argument is string. Optionally, argument can have the default value
669which will be used if no argument value is not given in a macro call.
670
671List of the argument definition:
672
673* `arg1` - simple argument
674* `arg1=value` - argument with default value
675* `arg1:req` - required argument
676* `arg:vararg` - variadic argument, get rest of the arguments and treats them as
677single (must be last)
678* `arg1:vararg:req` - required argument and variadic argument
679
680A macro calling is easy:
681
682```
683somemacro
684somemacro1 1,2,4
685somemacro1 1 2 3
686/* use variadic argument */
687.macro putHeaderAndData x,data:vararg
688    .byte \x&0x3f, \data
689.endm
690putHeaderAndData 0xfe,1,4,6,7,110
691```
692
693Some simple examples:
694
695```
696.macro putTwoBytes value1,value2
697    .byte \value1+\value2, \value2-\value1
698.endm
699putTwoBytes 4,7 # generates .byte 11,3
700.macro putTwoBytes2 value1=100,value2
701    .byte \value1+\value2, \value2-\value1
702.endm
703putTwoBytes2 ,7 # generates .byte 107,93
704```
705
706The argument substitution works inside double-quoted strings:
707
708```
709.macro putVersionInfo major,minor,micro
710.ascii "CLRadeonExtender \major\().\minor\().\micro"
711.endm
712putVersionInfo 1,2,3 # generates string "CLRadeonExtender 1.2.3"
713```
714
715It is possible to create the nested definitions like that:
716
717```
718.macro generators m,value1,value2
719    .macro gen\m x1,x2  # define genM with two arguments
720        /* use first and second operand of parent macro, and use two
721         * operands from this macro */
722        .int (\x1+\x2)*(\value1+\value2)
723    .endm   
724.endm
725/* define genF1 */
726generators F1,2,3
727/* use genF1, generates (10+12)*(2+3) -> 22*5 -> 110 */
728genF1 10,12
729```
730
731If macro argument starts with '\%' then rest of macro argument will be evaluated as
732expression and its results will be stored in string form (likewise '%EXPR' evaluation if
733alternate macro syntax is enabled).
734
735### .macrocase
736
737Enable ignoring letter's case in macro names (default behaviour).
738
739### .main
740
741Go to main binary over binary of the kernel.
742
743### .noaltmacro
744
745Disables alternate macro syntax.
746
747### .nobuggyfplit
748
749Disable old and buggy behavior for floating point literals and constants.
750
751### .nomacrocase
752
753Disable ignoring letter's case in macro names.
754
755### .nooldmodparam
756
757Disable old modifier parametrization that accepts only 0 and 1 values (to 0.1.5 version).
758
759### .octa
760
761Syntax: .octa OCTA-LITERAL,...
762
763Emit 128-bit word values. If no value between comma then an assembler stores 0 and warn
764about no value. This pseudo-operation accepts only 128-bit word literals.
765
766### .offset, .struct
767
768Syntax: .offset ABS-EXPR 
769Syntax: .struct ABS-EXPR
770
771Set the output counter to some place in absolute section. Useful to defining
772fields of the structures.
773
774### .oldmodparam
775
776Enable old modifier parametrization that accepts only 0 and 1 values (to 0.1.5 version)
777for compatibility.
778
779### .org
780
781Syntax: .org EXPRESSION
782
783Set the output counter to place defined by expression. Expression can point to some
784place in the code or some place to absolute section (absolute value). If a expression
785points to some place of a code, moving backwards is illegal.
786
787### .p2align
788
789Syntax: .p2align POWOF2ALIGN[, [VALUE] [, LIMIT]]
790
791Refer to `.align`. First argument is power of two of the alignment instead of
792same alignment.
793
794### .print
795
796Syntax: .print "STRING"
797
798Print string into standard output (or defined print output).
799
800### .purgem
801
802Syntax: .purgem MACRONAME
803
804Undefine macro MACRONAME.
805
806### .quad
807
808Syntax: .quad ABS-EXPR,....
809
810Emit 8-byte word values. If any expression is empty then an assembler
811stores 0 and warns about empty expression.
812
813### .rawcode
814
815This pseudo-operation should to be at begin of source.
816Choose raw code (same processor's instructions).
817
818### .regvar
819
820Syntax: .regvar REGVAR:REGTYPE:REGSNUM, ...
821
822Define new register variable (UNIMPLEMENTED).
823
824### .rept
825
826Syntax: .rept ABS-EXPR
827
828Open repetition. The code between this pseudo-operation and `.endr` will be repeated
829number given in first argument. Zero value is legal in first argument. Example:
830
831```
832.rept 3
833v_nop
834.endr
835```
836
837generates:
838
839```
840v_nop
841v_nop
842v_nop
843```
844
845### .rocm
846
847This pseudo-operation should to be at begin of source.
848Choose ROCm program binary format.
849
850### .rodata
851
852Go to `.rodata` section. If this section doesn't exist assembler create it.
853
854### .sbttl, .tittle, .version
855
856Syntax: .sbttl "STRING" 
857Syntax: .title "STRING" 
858Syntax: .version "STRING"
859
860These pseudo-operations are ignored by CLRX assembler.
861
862### .scope
863
864Syntax .scope [SCOPENAME]
865
866Open visbility's scope (if no name specified, then temporary scope).
867The labels (except local labels), symbols, scopes and regvars are defined
868inside scopes and visible inside them. The assembler create always global scope at begin.
869If scope doesn't exists then will be created. The nested scopes are allowed even
870if parent scope is temporary scope. The opened scope have parent that is previous scope.
871Temporary scopes exists until first close.
872
873### .section
874
875Syntax: .section SECTIONNAME[, "FLAGS"[, @TYPE]] [align=ALIGN]
876
877Go to specified section SECTIONNAME. If section doesn't exist assembler create it.
878Second optional argument set flags of the section. Can be from list:
879
880* `a` - allocatable section
881* `w` - writeable section in file
882* `x` - executable section
883
884Third optional argument set type of the section. Default section's type depends on
885the binary format. Type can be one of following type:
886
887* `progbits` - program data
888* `note` - informations about program or other things
889* `nobits` - doesn't contain data (only occupies space)
890
891The last attribute called 'align' set up section aligmnent.
892
893### .size
894
895Syntax: .size SYMBOL, ABS-EXPR
896
897Set size of symbol SYMBOL. Currently, this feature of symbol is not used by
898the CLRX assembler.
899
900### .skip, .space
901
902Syntax: .skip SIZE-EXPR[, VALUE-EXPR]
903Syntax: .space SIZE-EXPR[, VALUE-EXPR]
904
905Likewise as `.fill`, this pseudo-operation emits value (but byte) many times.
906First expression determines how many values should to be emitted, second expression
907determines what byte value should to be stored. If second expression is not given
908then assembler stores 0's.
909
910### .string, .string16, .string32, .string64
911
912Syntax: .string "STRING",.... 
913Syntax: .string16 "STRING",.... 
914Syntax: .string32 "STRING",.... 
915Syntax: .string64 "STRING",....
916
917Emit ASCII string. This pseudo-operations adds the
918null-terminated character. If more than one string will be given then all given
919string will be concatenated.
920`.string16` emits string with 2-byte characters.
921`.string32` emits string with 4-byte characters.
922`.string64` emits string with 8-byte characters.
923Characters longer than 1 byte will be zero expanded.
924
925### .text
926
927Go to `.text` section. If this section doesn't exist assembler create it.
928
929### .undef
930
931Syntax: .undef SYMBOL
932
933Undefine symbol. If symbol already doesn't exist then assembler warns about that.
934
935### .unusing
936
937Syntax: .unusing [SCOPEPATH]
938
939Stop using all objects (labels, symbols, regvar) in the specified scope or all
940previously used scopes (by '.using').
941
942### .using
943
944Syntax: .using SCOPEPATH
945
946Start use all objects (labels, symbols, scopes, regvar) in the specified scope.
947All objects (if they names is not hidden by object in current scope) will be visible
948directly including usings from specified scope. Searching object in current level of
949scope's stack is recursive and it traverse through 'usings' until object will be found.
950Assembler start searching object begins from the last declared 'using' to first 'using'.
951
952### .warning
953
954Syntax: .warning "STRING"
955
956Print warning message specified in first argument.
957
958### .weak
959
960Syntax: .weak SYMBOL,...
961
962Indicates that symbols will be a weak. Currently, unused feature of the symbol by
963the CLRX assembler.
964
965### .while
966
967Syntax: .while COND-EXPR
968
969Open 'while' repetition.The code between this pseudo-operation and `.endr` will be repeated
970until COND-EXPR returns zero. Example:
971
972```
973x=1
974.while x<16
975    .int x
976    x=x+x
977.endr
978```
979
980generates:
981
982```
983.int x      # x=1
984.int x      # x=2
985.int x      # x=4
986.int x      # x=8
987```
988
989### .word
990
991Syntax: .word ABS-EXPR,....
992
993Emit processor's word values. If any expression is empty then
994an assembler stores 0 and warns about empty expression. If expression will give a value
995that can not be stored in processor's word then an assembler warn about that.
996
997Processor's word have always 4 bytes.
Note: See TracBrowser for help on using the repository browser.