]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs
Merge commit '0c89065b934397b62838fe3e4ef6f6352fc52daf' into libgccjit-codegen
[rust.git] / compiler / rustc_codegen_gcc / src / intrinsic / llvm.rs
1 use gccjit::Function;
2
3 use crate::context::CodegenCx;
4
5 pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function<'gcc> {
6     let _gcc_name =
7         match name {
8             "llvm.x86.xgetbv" => {
9                 let gcc_name = "__builtin_trap";
10                 let func = cx.context.get_builtin_function(gcc_name);
11                 cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
12                 return func;
13             },
14             // TODO: this doc specifies the equivalent GCC builtins: http://huonw.github.io/llvmint/llvmint/x86/index.html
15             "llvm.x86.sse2.cmp.pd" => "__builtin_ia32_cmppd",
16             "llvm.x86.sse2.movmsk.pd" => "__builtin_ia32_movmskpd",
17             "llvm.x86.sse2.pmovmskb.128" => "__builtin_ia32_pmovmskb128",
18             _ => unimplemented!("unsupported LLVM intrinsic {}", name)
19         };
20
21     println!("Get target builtin");
22     unimplemented!();
23     /*let func = cx.context.get_target_builtin_function(gcc_name);
24     cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
25     func*/
26 }