43
43
irdl_op_definition ,
44
44
operand_def ,
45
45
opt_attr_def ,
46
+ opt_prop_def ,
46
47
region_def ,
47
48
result_def ,
48
49
var_operand_def ,
@@ -2491,7 +2492,7 @@ class LiOp(RISCVInstruction, ABC):
2491
2492
2492
2493
rd = result_def (IntRegisterType )
2493
2494
immediate = attr_def (base (Imm32Attr ) | base (LabelAttr ))
2494
- fastmath = opt_attr_def (FastMathFlagsAttr )
2495
+ fastmath = opt_prop_def (FastMathFlagsAttr )
2495
2496
2496
2497
traits = frozenset ((Pure (), ConstantLike (), LiOpHasCanonicalizationPatternTrait ()))
2497
2498
@@ -2500,7 +2501,7 @@ def __init__(
2500
2501
immediate : int | Imm32Attr | str | LabelAttr ,
2501
2502
* ,
2502
2503
rd : IntRegisterType | str | None = None ,
2503
- fastmath : FastMathFlagsAttr | None = None ,
2504
+ fastmath : FastMathFlagsAttr = FastMathFlagsAttr ( "none" ) ,
2504
2505
comment : str | StringAttr | None = None ,
2505
2506
):
2506
2507
if isinstance (immediate , int ):
@@ -2516,10 +2517,12 @@ def __init__(
2516
2517
2517
2518
super ().__init__ (
2518
2519
result_types = [rd ],
2520
+ properties = {
2521
+ "fastmath" : fastmath ,
2522
+ },
2519
2523
attributes = {
2520
2524
"immediate" : immediate ,
2521
2525
"comment" : comment ,
2522
- "fastmath" : fastmath ,
2523
2526
},
2524
2527
)
2525
2528
@@ -3037,15 +3040,15 @@ class RdRsRsFloatFloatIntegerOperationWithFastMath(RISCVInstruction, ABC):
3037
3040
rd = result_def (IntRegisterType )
3038
3041
rs1 = operand_def (FloatRegisterType )
3039
3042
rs2 = operand_def (FloatRegisterType )
3040
- fastmath = opt_attr_def (FastMathFlagsAttr )
3043
+ fastmath = opt_prop_def (FastMathFlagsAttr )
3041
3044
3042
3045
def __init__ (
3043
3046
self ,
3044
3047
rs1 : Operation | SSAValue ,
3045
3048
rs2 : Operation | SSAValue ,
3046
3049
* ,
3047
3050
rd : IntRegisterType | str | None = None ,
3048
- fastmath : FastMathFlagsAttr | None = None ,
3051
+ fastmath : FastMathFlagsAttr = FastMathFlagsAttr ( "none" ) ,
3049
3052
comment : str | StringAttr | None = None ,
3050
3053
):
3051
3054
if rd is None :
@@ -3057,8 +3060,10 @@ def __init__(
3057
3060
3058
3061
super ().__init__ (
3059
3062
operands = [rs1 , rs2 ],
3060
- attributes = {
3063
+ properties = {
3061
3064
"fastmath" : fastmath ,
3065
+ },
3066
+ attributes = {
3062
3067
"comment" : comment ,
3063
3068
},
3064
3069
result_types = [rd ],
@@ -3070,12 +3075,12 @@ def assembly_line_args(self) -> tuple[AssemblyInstructionArg, ...]:
3070
3075
@classmethod
3071
3076
def custom_parse_attributes (cls , parser : Parser ) -> dict [str , Attribute ]:
3072
3077
attributes = dict [str , Attribute ]()
3073
- flags = FastMathFlagsAttr ("none" )
3078
+ fast = FastMathFlagsAttr ("none" )
3074
3079
if parser .parse_optional_keyword ("fastmath" ) is not None :
3075
- flags = FastMathFlagsAttr (FastMathFlagsAttr .parse_parameter (parser ))
3076
- if flags != FastMathFlagsAttr ("none" ):
3077
- attributes ["fastmath" ] = flags
3078
- cls .fastmath = flags
3080
+ fast = FastMathFlagsAttr (FastMathFlagsAttr .parse_parameter (parser ))
3081
+ if fast != FastMathFlagsAttr ("none" ):
3082
+ attributes ["fastmath" ] = fast
3083
+ cls .fastmath = fast
3079
3084
return attributes
3080
3085
3081
3086
def custom_print_attributes (self , printer : Printer ) -> Set [str ]:
0 commit comments