Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
"__builtin_usub_overflow", "sqrtf", "sqrt", "__builtin_powif", "__builtin_powi", "sinf", "sin", "cosf", "cos",
"powf", "pow", "expf", "exp", "exp2f", "exp2", "logf", "log", "log10f", "log10", "log2f", "log2", "fmaf",
"fma", "fabsf", "fabs", "fminf", "fmin", "fmaxf", "fmax", "copysignf", "copysign", "floorf", "floor", "ceilf",
"ceil", "truncf", "trunc", "rintf", "rint", "nearbyintf", "nearbyint", "roundf", "round",
"ceil", "truncf", "trunc", "rintf", "rint", "nearbyintf", "nearbyint", "roundf", "round", "__builtin_prefetch",
"__builtin_expect_with_probability",
];

Expand Down
20 changes: 17 additions & 3 deletions src/intrinsic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,24 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
return;
}
sym::prefetch_read_data
| sym::prefetch_write_data
| sym::prefetch_read_instruction
| sym::prefetch_write_data => {
let a = args[0].immediate();
let void_ptr_type = self.context.new_type::<*const ()>();
let a_ptr = self.bitcast(a, void_ptr_type);

let b = match name {
sym::prefetch_read_data => self.const_i32(0),
sym::prefetch_write_data => self.const_i32(1),
_ => bug!(),
};

let builtin = self.context.get_builtin_function("__builtin_prefetch");
self.context.new_call(None, builtin, &[a_ptr, b]);
return;
}
sym::prefetch_read_instruction
| sym::prefetch_write_instruction => {
unimplemented!();
return;
}
sym::ctlz
| sym::ctlz_nonzero
Expand Down