Merge pull request #150 from bjorn3/bootstrap_missing_vendor_intrinsics

Add missing vendor intrinsics
This commit is contained in:
antoyo 2022-03-30 09:47:12 -04:00 committed by GitHub
commit 76cf7c2058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -79,7 +79,10 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_
// TODO(antoyo): only set on x86 platforms.
context.add_command_line_option("-masm=intel");
// TODO(antoyo): only add the following cli argument if the feature is supported.
context.add_command_line_option("-msse2");
context.add_command_line_option("-mavx2");
context.add_command_line_option("-msha");
context.add_command_line_option("-mpclmul");
// FIXME(antoyo): the following causes an illegal instruction on vmovdqu64 in std_example on my CPU.
// Only add if the CPU supports it.
//context.add_command_line_option("-mavx512f");

View File

@ -16,6 +16,7 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
"llvm.x86.avx2.pshuf.b" => "__builtin_ia32_pshufb256",
"llvm.x86.avx2.pslli.d" => "__builtin_ia32_pslldi256",
"llvm.x86.avx2.psrli.d" => "__builtin_ia32_psrldi256",
"llvm.x86.sse2.pslli.q" => "__builtin_ia32_psllqi128",
"llvm.x86.avx.vzeroupper" => "__builtin_ia32_vzeroupper",
"llvm.x86.avx2.vperm2i128" => "__builtin_ia32_permti256",
"llvm.x86.avx2.psrli.w" => "__builtin_ia32_psrlwi256",
@ -28,6 +29,11 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
"llvm.x86.avx2.pabs.b" => "__builtin_ia32_pabsb256",
"llvm.x86.avx2.psrli.q" => "__builtin_ia32_psrlqi256",
"llvm.x86.sse41.pblendvb" => "__builtin_ia32_pblendvb128",
"llvm.x86.sse41.pblendw" => "__builtin_ia32_pblendw128",
"llvm.x86.sse42.crc32.32.8" => "__builtin_ia32_crc32qi",
"llvm.x86.sse42.crc32.32.16" => "__builtin_ia32_crc32hi",
"llvm.x86.sse42.crc32.32.32" => "__builtin_ia32_crc32si",
"llvm.x86.sse42.crc32.64.64" => "__builtin_ia32_crc32di",
"llvm.x86.avx2.pavg.w" => "__builtin_ia32_pavgw256",
"llvm.x86.avx2.pavg.b" => "__builtin_ia32_pavgb256",
"llvm.x86.avx2.phadd.w" => "__builtin_ia32_phaddw256",
@ -113,6 +119,14 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
"llvm.x86.avx2.psrlv.q" => "__builtin_ia32_psrlv2di",
"llvm.x86.avx2.psrlv.q.256" => "__builtin_ia32_psrlv4di",
"llvm.x86.sse.sqrt.ss" => "__builtin_ia32_sqrtss",
"llvm.x86.pclmulqdq" => "__builtin_ia32_pclmulqdq128",
"llvm.x86.sha1msg1" => "__builtin_ia32_sha1msg1",
"llvm.x86.sha1msg2" => "__builtin_ia32_sha1msg2",
"llvm.x86.sha1nexte" => "__builtin_ia32_sha1nexte",
"llvm.x86.sha1rnds4" => "__builtin_ia32_sha1rnds4",
"llvm.x86.sha256msg1" => "__builtin_ia32_sha256msg1",
"llvm.x86.sha256msg2" => "__builtin_ia32_sha256msg2",
"llvm.x86.sha256rnds2" => "__builtin_ia32_sha256rnds2",
"llvm.sqrt.v2f64" => "__builtin_ia32_sqrtpd",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),