gccint: Int Iterators
1
1 17.23.3 Int Iterators
1 ---------------------
1
11 Int iterators operate in a similar way to code iterators. ⇒Code
Iterators.
1
1 The construct:
1
1 (define_int_iterator NAME [(INT1 "COND1") ... (INTN "CONDN")])
1
1 defines a pseudo integer constant NAME that can be instantiated as INTI
1 if condition CONDI is true. Each INT must have the same rtx format.
1 ⇒RTL Classes. Int iterators can appear in only those rtx fields
1 that have 'i' as the specifier. This means that each INT has to be a
1 constant defined using define_constant or define_c_enum.
1
1 As with mode and code iterators, each pattern that uses NAME will be
1 expanded N times, once with all uses of NAME replaced by INT1, once with
1 all uses replaced by INT2, and so on. ⇒Defining Mode Iterators.
1
1 It is possible to define attributes for ints as well as for codes and
1 modes. Attributes are defined using:
1
1 (define_int_attr NAME [(INT1 "VALUE1") ... (INTN "VALUEN")])
1
1 Here's an example of int iterators in action, taken from the ARM port:
1
1 (define_int_iterator QABSNEG [UNSPEC_VQABS UNSPEC_VQNEG])
1
1 (define_int_attr absneg [(UNSPEC_VQABS "abs") (UNSPEC_VQNEG "neg")])
1
1 (define_insn "neon_vq<absneg><mode>"
1 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
1 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
1 (match_operand:SI 2 "immediate_operand" "i")]
1 QABSNEG))]
1 "TARGET_NEON"
1 "vq<absneg>.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
1 [(set_attr "type" "neon_vqneg_vqabs")]
1 )
1
1
1 This is equivalent to:
1
1 (define_insn "neon_vqabs<mode>"
1 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
1 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
1 (match_operand:SI 2 "immediate_operand" "i")]
1 UNSPEC_VQABS))]
1 "TARGET_NEON"
1 "vqabs.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
1 [(set_attr "type" "neon_vqneg_vqabs")]
1 )
1
1 (define_insn "neon_vqneg<mode>"
1 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
1 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
1 (match_operand:SI 2 "immediate_operand" "i")]
1 UNSPEC_VQNEG))]
1 "TARGET_NEON"
1 "vqneg.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
1 [(set_attr "type" "neon_vqneg_vqabs")]
1 )
1
1