@@ -11,7 +11,7 @@ use rustc_middle::ty::{self, FloatTy};
11
11
use rustc_span:: { Symbol , sym} ;
12
12
13
13
use self :: atomic:: EvalContextExt as _;
14
- use self :: helpers:: { ToHost , ToSoft , check_arg_count } ;
14
+ use self :: helpers:: { ToHost , ToSoft , check_intrinsic_arg_count } ;
15
15
use self :: simd:: EvalContextExt as _;
16
16
use crate :: * ;
17
17
@@ -104,24 +104,24 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
104
104
105
105
// Raw memory accesses
106
106
"volatile_load" => {
107
- let [ place] = check_arg_count ( args) ?;
107
+ let [ place] = check_intrinsic_arg_count ( args) ?;
108
108
let place = this. deref_pointer ( place) ?;
109
109
this. copy_op ( & place, dest) ?;
110
110
}
111
111
"volatile_store" => {
112
- let [ place, dest] = check_arg_count ( args) ?;
112
+ let [ place, dest] = check_intrinsic_arg_count ( args) ?;
113
113
let place = this. deref_pointer ( place) ?;
114
114
this. copy_op ( dest, & place) ?;
115
115
}
116
116
117
117
"volatile_set_memory" => {
118
- let [ ptr, val_byte, count] = check_arg_count ( args) ?;
118
+ let [ ptr, val_byte, count] = check_intrinsic_arg_count ( args) ?;
119
119
this. write_bytes_intrinsic ( ptr, val_byte, count, "volatile_set_memory" ) ?;
120
120
}
121
121
122
122
// Memory model / provenance manipulation
123
123
"ptr_mask" => {
124
- let [ ptr, mask] = check_arg_count ( args) ?;
124
+ let [ ptr, mask] = check_intrinsic_arg_count ( args) ?;
125
125
126
126
let ptr = this. read_pointer ( ptr) ?;
127
127
let mask = this. read_target_usize ( mask) ?;
@@ -137,7 +137,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
137
137
// ```
138
138
// Would not be considered UB, or the other way around (`is_val_statically_known(0)`).
139
139
"is_val_statically_known" => {
140
- let [ _arg] = check_arg_count ( args) ?;
140
+ let [ _arg] = check_intrinsic_arg_count ( args) ?;
141
141
// FIXME: should we check for validity here? It's tricky because we do not have a
142
142
// place. Codegen does not seem to set any attributes like `noundef` for intrinsic
143
143
// calls, so we don't *have* to do anything.
@@ -146,7 +146,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
146
146
}
147
147
148
148
"floorf16" | "ceilf16" | "truncf16" | "roundf16" | "rintf16" => {
149
- let [ f] = check_arg_count ( args) ?;
149
+ let [ f] = check_intrinsic_arg_count ( args) ?;
150
150
let f = this. read_scalar ( f) ?. to_f16 ( ) ?;
151
151
let mode = match intrinsic_name {
152
152
"floorf16" => Round :: TowardNegative ,
@@ -161,7 +161,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
161
161
this. write_scalar ( res, dest) ?;
162
162
}
163
163
"floorf32" | "ceilf32" | "truncf32" | "roundf32" | "rintf32" => {
164
- let [ f] = check_arg_count ( args) ?;
164
+ let [ f] = check_intrinsic_arg_count ( args) ?;
165
165
let f = this. read_scalar ( f) ?. to_f32 ( ) ?;
166
166
let mode = match intrinsic_name {
167
167
"floorf32" => Round :: TowardNegative ,
@@ -176,7 +176,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
176
176
this. write_scalar ( res, dest) ?;
177
177
}
178
178
"floorf64" | "ceilf64" | "truncf64" | "roundf64" | "rintf64" => {
179
- let [ f] = check_arg_count ( args) ?;
179
+ let [ f] = check_intrinsic_arg_count ( args) ?;
180
180
let f = this. read_scalar ( f) ?. to_f64 ( ) ?;
181
181
let mode = match intrinsic_name {
182
182
"floorf64" => Round :: TowardNegative ,
@@ -191,7 +191,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
191
191
this. write_scalar ( res, dest) ?;
192
192
}
193
193
"floorf128" | "ceilf128" | "truncf128" | "roundf128" | "rintf128" => {
194
- let [ f] = check_arg_count ( args) ?;
194
+ let [ f] = check_intrinsic_arg_count ( args) ?;
195
195
let f = this. read_scalar ( f) ?. to_f128 ( ) ?;
196
196
let mode = match intrinsic_name {
197
197
"floorf128" => Round :: TowardNegative ,
@@ -216,7 +216,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
216
216
| "log10f32"
217
217
| "log2f32"
218
218
=> {
219
- let [ f] = check_arg_count ( args) ?;
219
+ let [ f] = check_intrinsic_arg_count ( args) ?;
220
220
let f = this. read_scalar ( f) ?. to_f32 ( ) ?;
221
221
// Using host floats except for sqrt (but it's fine, these operations do not have
222
222
// guaranteed precision).
@@ -244,7 +244,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
244
244
| "log10f64"
245
245
| "log2f64"
246
246
=> {
247
- let [ f] = check_arg_count ( args) ?;
247
+ let [ f] = check_intrinsic_arg_count ( args) ?;
248
248
let f = this. read_scalar ( f) ?. to_f64 ( ) ?;
249
249
// Using host floats except for sqrt (but it's fine, these operations do not have
250
250
// guaranteed precision).
@@ -264,7 +264,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
264
264
}
265
265
266
266
"fmaf32" => {
267
- let [ a, b, c] = check_arg_count ( args) ?;
267
+ let [ a, b, c] = check_intrinsic_arg_count ( args) ?;
268
268
let a = this. read_scalar ( a) ?. to_f32 ( ) ?;
269
269
let b = this. read_scalar ( b) ?. to_f32 ( ) ?;
270
270
let c = this. read_scalar ( c) ?. to_f32 ( ) ?;
@@ -274,7 +274,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
274
274
this. write_scalar ( res, dest) ?;
275
275
}
276
276
"fmaf64" => {
277
- let [ a, b, c] = check_arg_count ( args) ?;
277
+ let [ a, b, c] = check_intrinsic_arg_count ( args) ?;
278
278
let a = this. read_scalar ( a) ?. to_f64 ( ) ?;
279
279
let b = this. read_scalar ( b) ?. to_f64 ( ) ?;
280
280
let c = this. read_scalar ( c) ?. to_f64 ( ) ?;
@@ -285,7 +285,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
285
285
}
286
286
287
287
"fmuladdf32" => {
288
- let [ a, b, c] = check_arg_count ( args) ?;
288
+ let [ a, b, c] = check_intrinsic_arg_count ( args) ?;
289
289
let a = this. read_scalar ( a) ?. to_f32 ( ) ?;
290
290
let b = this. read_scalar ( b) ?. to_f32 ( ) ?;
291
291
let c = this. read_scalar ( c) ?. to_f32 ( ) ?;
@@ -300,7 +300,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
300
300
this. write_scalar ( res, dest) ?;
301
301
}
302
302
"fmuladdf64" => {
303
- let [ a, b, c] = check_arg_count ( args) ?;
303
+ let [ a, b, c] = check_intrinsic_arg_count ( args) ?;
304
304
let a = this. read_scalar ( a) ?. to_f64 ( ) ?;
305
305
let b = this. read_scalar ( b) ?. to_f64 ( ) ?;
306
306
let c = this. read_scalar ( c) ?. to_f64 ( ) ?;
@@ -316,7 +316,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
316
316
}
317
317
318
318
"powf32" => {
319
- let [ f1, f2] = check_arg_count ( args) ?;
319
+ let [ f1, f2] = check_intrinsic_arg_count ( args) ?;
320
320
let f1 = this. read_scalar ( f1) ?. to_f32 ( ) ?;
321
321
let f2 = this. read_scalar ( f2) ?. to_f32 ( ) ?;
322
322
// Using host floats (but it's fine, this operation does not have guaranteed precision).
@@ -325,7 +325,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
325
325
this. write_scalar ( res, dest) ?;
326
326
}
327
327
"powf64" => {
328
- let [ f1, f2] = check_arg_count ( args) ?;
328
+ let [ f1, f2] = check_intrinsic_arg_count ( args) ?;
329
329
let f1 = this. read_scalar ( f1) ?. to_f64 ( ) ?;
330
330
let f2 = this. read_scalar ( f2) ?. to_f64 ( ) ?;
331
331
// Using host floats (but it's fine, this operation does not have guaranteed precision).
@@ -335,7 +335,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
335
335
}
336
336
337
337
"powif32" => {
338
- let [ f, i] = check_arg_count ( args) ?;
338
+ let [ f, i] = check_intrinsic_arg_count ( args) ?;
339
339
let f = this. read_scalar ( f) ?. to_f32 ( ) ?;
340
340
let i = this. read_scalar ( i) ?. to_i32 ( ) ?;
341
341
// Using host floats (but it's fine, this operation does not have guaranteed precision).
@@ -344,7 +344,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
344
344
this. write_scalar ( res, dest) ?;
345
345
}
346
346
"powif64" => {
347
- let [ f, i] = check_arg_count ( args) ?;
347
+ let [ f, i] = check_intrinsic_arg_count ( args) ?;
348
348
let f = this. read_scalar ( f) ?. to_f64 ( ) ?;
349
349
let i = this. read_scalar ( i) ?. to_i32 ( ) ?;
350
350
// Using host floats (but it's fine, this operation does not have guaranteed precision).
@@ -360,7 +360,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
360
360
| "fdiv_algebraic"
361
361
| "frem_algebraic"
362
362
=> {
363
- let [ a, b] = check_arg_count ( args) ?;
363
+ let [ a, b] = check_intrinsic_arg_count ( args) ?;
364
364
let a = this. read_immediate ( a) ?;
365
365
let b = this. read_immediate ( b) ?;
366
366
let op = match intrinsic_name {
@@ -383,7 +383,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
383
383
| "fdiv_fast"
384
384
| "frem_fast"
385
385
=> {
386
- let [ a, b] = check_arg_count ( args) ?;
386
+ let [ a, b] = check_intrinsic_arg_count ( args) ?;
387
387
let a = this. read_immediate ( a) ?;
388
388
let b = this. read_immediate ( b) ?;
389
389
let op = match intrinsic_name {
@@ -427,7 +427,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
427
427
}
428
428
429
429
"float_to_int_unchecked" => {
430
- let [ val] = check_arg_count ( args) ?;
430
+ let [ val] = check_intrinsic_arg_count ( args) ?;
431
431
let val = this. read_immediate ( val) ?;
432
432
433
433
let res = this
@@ -444,7 +444,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
444
444
445
445
// Other
446
446
"breakpoint" => {
447
- let [ ] = check_arg_count ( args) ?;
447
+ let [ ] = check_intrinsic_arg_count ( args) ?;
448
448
// normally this would raise a SIGTRAP, which aborts if no debugger is connected
449
449
throw_machine_stop ! ( TerminationInfo :: Abort ( format!( "trace/breakpoint trap" ) ) )
450
450
}
0 commit comments