Skip to content

Commit a0654b3

Browse files
committed
Implement llvm.prefetch
1 parent 98f0dc1 commit a0654b3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/intrinsic/llvm.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(builder: &Builder<'a, 'gcc
236236
let arg2 = builder.context.new_cast(None, arg2, arg2_type);
237237
args = vec![new_args[0], arg2].into();
238238
},
239+
"__builtin_prefetch" => {
240+
let mut new_args = args.to_vec();
241+
new_args.pop();
242+
args = new_args.into();
243+
},
239244
_ => (),
240245
}
241246
}
@@ -393,6 +398,16 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
393398

394399
#[cfg(feature="master")]
395400
pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function<'gcc> {
401+
match name {
402+
"llvm.prefetch" => {
403+
let gcc_name = "__builtin_prefetch";
404+
let func = cx.context.get_builtin_function(gcc_name);
405+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
406+
return func
407+
},
408+
_ => (),
409+
}
410+
396411
let gcc_name = match name {
397412
"llvm.x86.xgetbv" => "__builtin_ia32_xgetbv",
398413
// NOTE: this doc specifies the equivalent GCC builtins: http://huonw.github.io/llvmint/llvmint/x86/index.html

0 commit comments

Comments
 (0)