@@ -88,21 +88,24 @@ macro_rules! simple_op {
88
88
assert_ty_eq!( self , lhs. ty, rhs. ty) ;
89
89
let result_type = lhs. ty;
90
90
91
- $( if let Some ( const_lhs) = self . try_get_const_value( lhs) {
92
- if let Some ( const_rhs) = self . try_get_const_value( rhs) {
93
- #[ allow( unreachable_patterns) ]
94
- match ( const_lhs, const_rhs) {
95
- $(
96
- ( ConstValue :: Unsigned ( $int_lhs) , ConstValue :: Unsigned ( $int_rhs) ) => return self . const_uint_big( result_type, $fold_int) ,
97
- ( ConstValue :: Signed ( $int_lhs) , ConstValue :: Signed ( $int_rhs) ) => return self . const_uint_big( result_type, $fold_int as u128 ) ,
98
- ) ?
99
- $( ( ConstValue :: Unsigned ( $uint_lhs) , ConstValue :: Unsigned ( $uint_rhs) ) => return self . const_uint_big( result_type, $fold_uint) , ) ?
100
- $( ( ConstValue :: Signed ( $sint_lhs) , ConstValue :: Signed ( $sint_rhs) ) => return self . const_uint_big( result_type, $fold_sint as u128 ) , ) ?
101
- $( ( ConstValue :: Bool ( $bool_lhs) , ConstValue :: Bool ( $bool_rhs) ) => return self . const_uint_big( result_type, ( $fold_bool) . into( ) ) , ) ?
102
- _ => ( ) ,
91
+ $(
92
+ #[ allow( unreachable_patterns, clippy:: collapsible_match) ]
93
+ if let Some ( const_lhs) = self . try_get_const_value( lhs) {
94
+ if let Some ( const_rhs) = self . try_get_const_value( rhs) {
95
+ #[ allow( unreachable_patterns) ]
96
+ match ( const_lhs, const_rhs) {
97
+ $(
98
+ ( ConstValue :: Unsigned ( $int_lhs) , ConstValue :: Unsigned ( $int_rhs) ) => return self . const_uint_big( result_type, $fold_int) ,
99
+ ( ConstValue :: Signed ( $int_lhs) , ConstValue :: Signed ( $int_rhs) ) => return self . const_uint_big( result_type, $fold_int as u128 ) ,
100
+ ) ?
101
+ $( ( ConstValue :: Unsigned ( $uint_lhs) , ConstValue :: Unsigned ( $uint_rhs) ) => return self . const_uint_big( result_type, $fold_uint) , ) ?
102
+ $( ( ConstValue :: Signed ( $sint_lhs) , ConstValue :: Signed ( $sint_rhs) ) => return self . const_uint_big( result_type, $fold_sint as u128 ) , ) ?
103
+ $( ( ConstValue :: Bool ( $bool_lhs) , ConstValue :: Bool ( $bool_rhs) ) => return self . const_uint_big( result_type, ( $fold_bool) . into( ) ) , ) ?
104
+ _ => ( ) ,
105
+ }
103
106
}
104
107
}
105
- } ) ?
108
+ ) ?
106
109
107
110
match self . lookup_type( result_type) {
108
111
$( SpirvType :: Integer ( _, _) => {
@@ -149,22 +152,25 @@ macro_rules! simple_shift_op {
149
152
fn $func_name( & mut self , lhs: Self :: Value , rhs: Self :: Value ) -> Self :: Value {
150
153
let result_type = lhs. ty;
151
154
152
- $( if let Some ( const_lhs) = self . try_get_const_value( lhs) {
153
- if let Some ( const_rhs) = self . try_get_const_value( rhs) {
154
- #[ allow( unreachable_patterns) ]
155
- match ( const_lhs, const_rhs) {
156
- $(
157
- ( ConstValue :: Unsigned ( $shift_uint_lhs) , ConstValue :: Unsigned ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_uint) ,
158
- ( ConstValue :: Unsigned ( $shift_uint_lhs) , ConstValue :: Signed ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_uint) ,
159
- ) ?
160
- $(
161
- ( ConstValue :: Signed ( $shift_int_lhs) , ConstValue :: Unsigned ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_int) ,
162
- ( ConstValue :: Signed ( $shift_int_lhs) , ConstValue :: Signed ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_int) ,
163
- ) ?
164
- _ => ( ) ,
155
+ $(
156
+ #[ allow( unreachable_patterns, clippy:: collapsible_match) ]
157
+ if let Some ( const_lhs) = self . try_get_const_value( lhs) {
158
+ if let Some ( const_rhs) = self . try_get_const_value( rhs) {
159
+ #[ allow( unreachable_patterns) ]
160
+ match ( const_lhs, const_rhs) {
161
+ $(
162
+ ( ConstValue :: Unsigned ( $shift_uint_lhs) , ConstValue :: Unsigned ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_uint) ,
163
+ ( ConstValue :: Unsigned ( $shift_uint_lhs) , ConstValue :: Signed ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_uint) ,
164
+ ) ?
165
+ $(
166
+ ( ConstValue :: Signed ( $shift_int_lhs) , ConstValue :: Unsigned ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_int) ,
167
+ ( ConstValue :: Signed ( $shift_int_lhs) , ConstValue :: Signed ( $shift_uint_rhs) ) => return self . const_uint_big( result_type, $fold_shift_int) ,
168
+ ) ?
169
+ _ => ( ) ,
170
+ }
165
171
}
166
172
}
167
- } ) ?
173
+ ) ?
168
174
169
175
self . emit( )
170
176
. $inst_name( result_type, None , lhs. def( self ) , rhs. def( self ) )
@@ -192,19 +198,21 @@ macro_rules! simple_uni_op {
192
198
fn $func_name( & mut self , val: Self :: Value ) -> Self :: Value {
193
199
let result_type = val. ty;
194
200
195
- $( if let Some ( const_val) = self . try_get_const_value( val) {
196
- #[ allow( unreachable_patterns) ]
197
- match const_val {
198
- $(
199
- ConstValue :: Unsigned ( $int_val) => return self . const_uint_big( result_type, $fold_int) ,
200
- ConstValue :: Signed ( $int_val) => return self . const_uint_big( result_type, $fold_int as u128 ) ,
201
- ) ?
202
- $( ConstValue :: Unsigned ( $uint_val) => return self . const_uint_big( result_type, $fold_uint) , ) ?
203
- $( ConstValue :: Signed ( $sint_val) => return self . const_uint_big( result_type, $fold_sint as u128 ) , ) ?
204
- $( ConstValue :: Bool ( $bool_val) => return self . const_uint_big( result_type, ( $fold_bool) . into( ) ) , ) ?
205
- _ => ( ) ,
201
+ $(
202
+ #[ allow( unreachable_patterns, clippy:: collapsible_match) ]
203
+ if let Some ( const_val) = self . try_get_const_value( val) {
204
+ match const_val {
205
+ $(
206
+ ConstValue :: Unsigned ( $int_val) => return self . const_uint_big( result_type, $fold_int) ,
207
+ ConstValue :: Signed ( $int_val) => return self . const_uint_big( result_type, $fold_int as u128 ) ,
208
+ ) ?
209
+ $( ConstValue :: Unsigned ( $uint_val) => return self . const_uint_big( result_type, $fold_uint) , ) ?
210
+ $( ConstValue :: Signed ( $sint_val) => return self . const_uint_big( result_type, $fold_sint as u128 ) , ) ?
211
+ $( ConstValue :: Bool ( $bool_val) => return self . const_uint_big( result_type, ( $fold_bool) . into( ) ) , ) ?
212
+ _ => ( ) ,
213
+ }
206
214
}
207
- } ) ?
215
+ ) ?
208
216
209
217
match self . lookup_type( result_type) {
210
218
$( SpirvType :: Integer ( _, _) => {
0 commit comments