📄 rtl.texi
字号:
@itemx (umod:@var{m} @var{x} @var{y})Like @code{div} and @code{udiv} but represent the remainder instead ofthe quotient.@findex smin@findex smax@cindex signed minimum@cindex signed maximum@item (smin:@var{m} @var{x} @var{y})@itemx (smax:@var{m} @var{x} @var{y})Represents the smaller (for @code{smin}) or larger (for @code{smax}) of@var{x} and @var{y}, interpreted as signed integers in mode @var{m}.@findex umin@findex umax@cindex unsigned minimum and maximum@item (umin:@var{m} @var{x} @var{y})@itemx (umax:@var{m} @var{x} @var{y})Like @code{smin} and @code{smax}, but the values are interpreted as unsignedintegers.@findex not@cindex complement, bitwise@cindex bitwise complement@item (not:@var{m} @var{x})Represents the bitwise complement of the value represented by @var{x},carried out in mode @var{m}, which must be a fixed-point machine mode.@findex and@cindex logical-and, bitwise@cindex bitwise logical-and@item (and:@var{m} @var{x} @var{y})Represents the bitwise logical-and of the values represented by@var{x} and @var{y}, carried out in machine mode @var{m}, which must bea fixed-point machine mode.@findex ior@cindex inclusive-or, bitwise@cindex bitwise inclusive-or@item (ior:@var{m} @var{x} @var{y})Represents the bitwise inclusive-or of the values represented by @var{x}and @var{y}, carried out in machine mode @var{m}, which must be afixed-point mode.@findex xor@cindex exclusive-or, bitwise@cindex bitwise exclusive-or@item (xor:@var{m} @var{x} @var{y})Represents the bitwise exclusive-or of the values represented by @var{x}and @var{y}, carried out in machine mode @var{m}, which must be afixed-point mode.@findex ashift@cindex left shift@cindex shift@cindex arithmetic shift@item (ashift:@var{m} @var{x} @var{c})Represents the result of arithmetically shifting @var{x} left by @var{c}places. @var{x} have mode @var{m}, a fixed-point machine mode. @var{c}be a fixed-point mode or be a constant with mode @code{VOIDmode}; whichmode is determined by the mode called for in the machine descriptionentry for the left-shift instruction. For example, on the Vax, the modeof @var{c} is @code{QImode} regardless of @var{m}.@findex lshift@cindex left shift@cindex logical shift@item (lshift:@var{m} @var{x} @var{c})Like @code{ashift} but for logical left shift. @code{ashift} and@code{lshift} are identical operations; we customarily use @code{ashift}for both.@findex lshiftrt@cindex right shift@findex ashiftrt@item (lshiftrt:@var{m} @var{x} @var{c})@itemx (ashiftrt:@var{m} @var{x} @var{c})Like @code{lshift} and @code{ashift} but for right shift. Unlikethe case for left shift, these two operations are distinct.@findex rotate@cindex rotate @cindex left rotate@findex rotatert@cindex right rotate@item (rotate:@var{m} @var{x} @var{c})@itemx (rotatert:@var{m} @var{x} @var{c})Similar but represent left and right rotate. If @var{c} is a constant,use @code{rotate}.@findex abs@cindex absolute value@item (abs:@var{m} @var{x})Represents the absolute value of @var{x}, computed in mode @var{m}.@findex sqrt@cindex square root@item (sqrt:@var{m} @var{x})Represents the square root of @var{x}, computed in mode @var{m}.Most often @var{m} will be a floating point mode.@findex ffs@item (ffs:@var{m} @var{x})Represents one plus the index of the least significant 1-bit in@var{x}, represented as an integer of mode @var{m}. (The value iszero if @var{x} is zero.) The mode of @var{x} need not be @var{m};depending on the target machine, various mode combinations may bevalid.@end table@node Comparisons, Bit Fields, Arithmetic, RTL@section Comparison Operations@cindex RTL comparison operationsComparison operators test a relation on two operands and are consideredto represent a machine-dependent nonzero value described by, but notnecessarily equal to, @code{STORE_FLAG_VALUE} (@pxref{Misc})if the relation holds, or zero if it does not. The mode of thecomparison operation is independent of the mode of the data beingcompared. If the comparison operation is being tested (e.g., the firstoperand of an @code{if_then_else}), the mode must be @code{VOIDmode}.If the comparison operation is producing data to be stored in somevariable, the mode must be in class @code{MODE_INT}. All comparisonoperations producing data must use the same mode, which ismachine-specific.@cindex condition codesThere are two ways that comparison operations may be used. Thecomparison operators may be used to compare the condition codes@code{(cc0)} against zero, as in @code{(eq (cc0) (const_int 0))}. Sucha construct actually refers to the result of the preceding instructionin which the condition codes were set. The instructing setting thecondition code must be adjacent to the instruction using the conditioncode; only @code{note} insns may separate them.Alternatively, a comparison operation may directly compare two dataobjects. The mode of the comparison is determined by the operands; theymust both be valid for a common machine mode. A comparison with bothoperands constant would be invalid as the machine mode could not bededuced from it, but such a comparison should never exist in RTL due toconstant folding.In the example above, if @code{(cc0)} were last set to@code{(compare @var{x} @var{y})}, the comparison operation isidentical to @code{(eq @var{x} @var{y})}. Usually only one styleof comparisons is supported on a particular machine, but the combinepass will try to merge the operations to produce the @code{eq} shownin case it exists in the context of the particular insn involved.Inequality comparisons come in two flavors, signed and unsigned. Thus,there are distinct expression codes @code{gt} and @code{gtu} for signed andunsigned greater-than. These can produce different results for the samepair of integer values: for example, 1 is signed greater-than -1 but notunsigned greater-than, because -1 when regarded as unsigned is actually@code{0xffffffff} which is greater than 1.The signed comparisons are also used for floating point values. Floatingpoint comparisons are distinguished by the machine modes of the operands.@table @code@findex eq@cindex equal@item (eq:@var{m} @var{x} @var{y})1 if the values represented by @var{x} and @var{y} are equal,otherwise 0.@findex ne@cindex not equal@item (ne:@var{m} @var{x} @var{y})1 if the values represented by @var{x} and @var{y} are not equal,otherwise 0.@findex gt@cindex greater than@item (gt:@var{m} @var{x} @var{y})1 if the @var{x} is greater than @var{y}. If they are fixed-point,the comparison is done in a signed sense.@findex gtu@cindex greater than@cindex unsigned greater than@item (gtu:@var{m} @var{x} @var{y})Like @code{gt} but does unsigned comparison, on fixed-point numbers only.@findex lt@cindex less than@findex ltu@cindex unsigned less than@item (lt:@var{m} @var{x} @var{y})@itemx (ltu:@var{m} @var{x} @var{y})Like @code{gt} and @code{gtu} but test for ``less than''.@findex ge@cindex greater than@findex geu@cindex unsigned greater than@item (ge:@var{m} @var{x} @var{y})@itemx (geu:@var{m} @var{x} @var{y})Like @code{gt} and @code{gtu} but test for ``greater than or equal''.@findex le@cindex less than or equal@findex leu@cindex unsigned less than@item (le:@var{m} @var{x} @var{y})@itemx (leu:@var{m} @var{x} @var{y})Like @code{gt} and @code{gtu} but test for ``less than or equal''.@findex if_then_else@item (if_then_else @var{cond} @var{then} @var{else})This is not a comparison operation but is listed here because it isalways used in conjunction with a comparison operation. To beprecise, @var{cond} is a comparison expression. This expressionrepresents a choice, according to @var{cond}, between the valuerepresented by @var{then} and the one represented by @var{else}.On most machines, @code{if_then_else} expressions are valid onlyto express conditional jumps.@findex cond@item (cond [@var{test1} @var{value1} @var{test2} @var{value2} @dots{}] @var{default})Similar to @code{if_then_else}, but more general. Each of @var{test1},@var{test2}, @dots{} is performed in turn. The result of this expression isthe @var{value} corresponding to the first non-zero test, or @var{default} ifnone of the tests are non-zero expressions.This is currently not valid for instruction patterns and is supported onlyfor insn attributes. @xref{Insn Attributes}.@end table@node Bit Fields, Conversions, Comparisons, RTL@section Bit Fields@cindex bit fieldsSpecial expression codes exist to represent bit-field instructions.These types of expressions are lvalues in RTL; they may appearon the left side of an assignment, indicating insertion of a valueinto the specified bit field.@table @code@findex sign_extract@cindex @code{BITS_BIG_ENDIAN}, effect on @code{sign_extract}@item (sign_extract:@var{m} @var{loc} @var{size} @var{pos})This represents a reference to a sign-extended bit field contained orstarting in @var{loc} (a memory or register reference). The bit fieldis @var{size} bits wide and starts at bit @var{pos}. The compilationoption @code{BITS_BIG_ENDIAN} says which end of the memory unit@var{pos} counts from.If @var{loc} is in memory, its mode must be a single-byte integer mode.If @var{loc} is in a register, the mode to use is specified by theoperand of the @code{insv} or @code{extv} pattern(@pxref{Standard Names}) and is usually a full-word integer mode.The mode of @var{pos} is machine-specific and is also specifiedin the @code{insv} or @code{extv} pattern.The mode @var{m} is the same as the mode that would be used for@var{loc} if it were a register.@findex zero_extract@item (zero_extract:@var{m} @var{loc} @var{size} @var{pos})Like @code{sign_extract} but refers to an unsigned or zero-extendedbit field. The same sequence of bits are extracted, but theyare filled to an entire word with zeros instead of by sign-extension.@end table@node Conversions, RTL Declarations, Bit Fields, RTL@section Conversions@cindex conversions@cindex machine mode conversionsAll conversions between machine modes must be represented byexplicit conversion operations. For example, an expressionwhich is the sum of a byte and a full word cannot be written as@code{(plus:SI (reg:QI 34) (reg:SI 80))} because the @code{plus}operation requires two operands of the same machine mode.Therefore, the byte-sized operand is enclosed in a conversionoperation, as in@example(plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))@end exampleThe conversion operation is not a mere placeholder, because theremay be more than one way of converting from a given starting modeto the desired final mode. The conversion operation code says howto do it.For all conversion operations, @var{x} must not be @code{VOIDmode}because the mode in which to do the conversion would not be known.The conversion must either be done at compile-time or @var{x}must be placed into a register.@table @code@findex sign_extend@item (sign_extend:@var{m} @var{x})Represents the result of sign-extending the value @var{x}to machine mode @var{m}. @var{m} must be a fixed-point modeand @var{x} a fixed-point value of a mode narrower than @var{m}.@findex zero_extend@item (zero_extend:@var{m} @var{x})Represents the result of zero-extending the value @var{x}to machine mode @var{m}. @var{m} must be a fixed-point modeand @var{x} a fixed-point value of a mode narrower than @var{m}.@findex float_extend@item (float_extend:@var{m} @var{x})Represents the result of extending the value @var{x}to machine mode @var{m}. @var{m} must be a floating point modeand @var{x} a floating point value of a mode narrower than @var{m}.@findex truncate@item (truncate:@var{m} @var{x})Represents the result of truncating the value @var{x}to machine mode @var{m}. @var{m} must be a fixed-point modeand @var{x} a fixed-point value of a mode wider than @var{m}.@findex float_truncate@item (float_truncate:@var{m} @var{x})Represents the result of truncating the value @var{x}to machine mode @var{m}. @var{m} must be a floating point modeand @var{x} a floating point value of a mode wider than @var{m}.@findex float@item (float:@var{m} @var{x})Represents the result of converting fixed point value @var{x},regarded as signed, to floating point mode @var{m}.@findex unsigned_float@item (unsigned_float:@var{m}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -