about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2021-08-12 21:53:49 -0400
committerAntoni Boucher <bouanto@zoho.com>2021-08-12 21:53:49 -0400
commitf7237f16ae1c94e35b1927f0e25aef4a3a6e3f22 (patch)
treee6b06bb2124751d299cae8600981517e9de8624d /compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs
parentae90dcf0207c57c3034f00b07048d63f8b2363c8 (diff)
parentafae271d5d3719eeb92c18bc004bb6d1965a5f3f (diff)
downloadrust-f7237f16ae1c94e35b1927f0e25aef4a3a6e3f22.tar.gz
rust-f7237f16ae1c94e35b1927f0e25aef4a3a6e3f22.zip
Add 'compiler/rustc_codegen_gcc/' from commit 'afae271d5d3719eeb92c18bc004bb6d1965a5f3f'
git-subtree-dir: compiler/rustc_codegen_gcc
git-subtree-mainline: ae90dcf0207c57c3034f00b07048d63f8b2363c8
git-subtree-split: afae271d5d3719eeb92c18bc004bb6d1965a5f3f
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs')
-rw-r--r--compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs b/compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs
new file mode 100644
index 00000000000..bf9472d3ea9
--- /dev/null
+++ b/compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs
@@ -0,0 +1,26 @@
+use gccjit::Function;
+
+use crate::context::CodegenCx;
+
+pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function<'gcc> {
+    let _gcc_name =
+        match name {
+            "llvm.x86.xgetbv" => {
+                let gcc_name = "__builtin_trap";
+                let func = cx.context.get_builtin_function(gcc_name);
+                cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
+                return func;
+            },
+            // TODO: this doc specifies the equivalent GCC builtins: http://huonw.github.io/llvmint/llvmint/x86/index.html
+            "llvm.x86.sse2.cmp.pd" => "__builtin_ia32_cmppd",
+            "llvm.x86.sse2.movmsk.pd" => "__builtin_ia32_movmskpd",
+            "llvm.x86.sse2.pmovmskb.128" => "__builtin_ia32_pmovmskb128",
+            _ => unimplemented!("unsupported LLVM intrinsic {}", name)
+        };
+
+    println!("Get target builtin");
+    unimplemented!();
+    /*let func = cx.context.get_target_builtin_function(gcc_name);
+    cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
+    func*/
+}