Skip to content

Commit 1e8354a

Browse files
committed
Fix mapping
1 parent 7d4d356 commit 1e8354a

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

src/builder.rs

+2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
285285
);
286286
// TODO(antoyo): perhaps use __builtin_convertvector for vector casting.
287287
// TODO: remove bitcast now that vector types can be compared?
288+
// ==> We use bitcast to avoid having to do many manual casts from e.g. __m256i to __v32qi (in
289+
// the case of _mm256_aesenc_epi128).
288290
self.bitcast(actual_val, expected_ty)
289291
}
290292
} else {

src/intrinsic/llvm.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,12 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(
466466
let arg1_type = gcc_func.get_param_type(0);
467467
let arg2_type = gcc_func.get_param_type(1);
468468
let arg3_type = gcc_func.get_param_type(2);
469-
let arg5_type = gcc_func.get_param_type(4);
469+
let arg4_type = gcc_func.get_param_type(3);
470470
let a = builder.context.new_rvalue_from_vector(None, arg1_type, &[new_args[0]; 8]);
471471
let b = builder.context.new_rvalue_from_vector(None, arg2_type, &[new_args[1]; 8]);
472472
let c = builder.context.new_rvalue_from_vector(None, arg3_type, &[new_args[2]; 8]);
473-
let arg5 = builder.context.new_rvalue_from_int(arg5_type, 4);
474-
args = vec![a, b, c, new_args[3], arg5].into();
473+
let arg4 = builder.context.new_rvalue_from_int(arg4_type, -1);
474+
args = vec![a, b, c, arg4, new_args[3]].into();
475475
}
476476
_ => (),
477477
}
@@ -604,7 +604,13 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(
604604
new_args[2] = builder.context.new_cast(None, new_args[2], builder.double_type);
605605
args = new_args.into();
606606
}
607-
"__builtin_ia32_sqrtsh_mask_round" => {
607+
"__builtin_ia32_sqrtsh_mask_round"
608+
| "__builtin_ia32_vcvtss2sh_mask_round"
609+
| "__builtin_ia32_vcvtsd2sh_mask_round"
610+
| "__builtin_ia32_vcvtsh2ss_mask_round"
611+
| "__builtin_ia32_vcvtsh2sd_mask_round"
612+
| "__builtin_ia32_rcpsh_mask"
613+
| "__builtin_ia32_rsqrtsh_mask" => {
608614
// The first two arguments are inverted, so swap them.
609615
let mut new_args = args.to_vec();
610616
new_args.swap(0, 1);
@@ -1192,11 +1198,11 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
11921198
"llvm.x86.avx512fp16.mask.vfcmul.csh" => "__builtin_ia32_vfcmulcsh_mask_round",
11931199
"llvm.x86.avx512fp16.mask.vfmadd.cph.512" => "__builtin_ia32_vfmaddcph512_mask3_round",
11941200
"llvm.x86.avx512fp16.maskz.vfmadd.cph.512" => "__builtin_ia32_vfmaddcph512_maskz_round",
1195-
"llvm.x86.avx512fp16.mask.vfmadd.csh" => "__builtin_ia32_vfmaddcsh_mask3_round",
1201+
"llvm.x86.avx512fp16.mask.vfmadd.csh" => "__builtin_ia32_vfmaddcsh_mask_round",
11961202
"llvm.x86.avx512fp16.maskz.vfmadd.csh" => "__builtin_ia32_vfmaddcsh_maskz_round",
11971203
"llvm.x86.avx512fp16.mask.vfcmadd.cph.512" => "__builtin_ia32_vfcmaddcph512_mask3_round",
11981204
"llvm.x86.avx512fp16.maskz.vfcmadd.cph.512" => "__builtin_ia32_vfcmaddcph512_maskz_round",
1199-
"llvm.x86.avx512fp16.mask.vfcmadd.csh" => "__builtin_ia32_vfcmaddcsh_mask_round",
1205+
"llvm.x86.avx512fp16.mask.vfcmadd.csh" => "__builtin_ia32_vfcmaddcsh_mask3_round",
12001206
"llvm.x86.avx512fp16.maskz.vfcmadd.csh" => "__builtin_ia32_vfcmaddcsh_maskz_round",
12011207
"llvm.x86.avx512fp16.vfmadd.ph.512" => "__builtin_ia32_vfmaddph512_mask",
12021208
"llvm.x86.avx512fp16.vcvtsi642sh" => "__builtin_ia32_vcvtsi2sh64_round",
@@ -1209,7 +1215,7 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
12091215
"llvm.x86.avx512.mask.load.pd.256" => "__builtin_ia32_loadapd256_mask",
12101216
"llvm.x86.avx512.mask.load.d.128" => "__builtin_ia32_movdqa32load128_mask",
12111217
"llvm.x86.avx512.mask.load.q.128" => "__builtin_ia32_movdqa64load128_mask",
1212-
"llvm.x86.avx512.mask.load.ps.128" => "__builtin_ia32_movdqa64load128_mask",
1218+
"llvm.x86.avx512.mask.load.ps.128" => "__builtin_ia32_loadaps128_mask",
12131219
"llvm.x86.avx512.mask.load.pd.128" => "__builtin_ia32_loadapd128_mask",
12141220
"llvm.x86.avx512.mask.storeu.d.256" => "__builtin_ia32_storedqusi256_mask",
12151221
"llvm.x86.avx512.mask.storeu.q.256" => "__builtin_ia32_storedqudi256_mask",
@@ -1283,6 +1289,10 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
12831289
"llvm.x86.avx512fp16.mask.vcvttph2uqq.512" => "__builtin_ia32_vcvttph2uqq512_mask_round",
12841290
"llvm.x86.avx512fp16.mask.vcvtph2psx.512" => "__builtin_ia32_vcvtph2psx512_mask_round",
12851291
"llvm.x86.avx512fp16.mask.vcvtph2pd.512" => "__builtin_ia32_vcvtph2pd512_mask_round",
1292+
"llvm.x86.avx512fp16.mask.vfcmadd.cph.256" => "__builtin_ia32_vfcmaddcph256_mask3",
1293+
"llvm.x86.avx512fp16.mask.vfmadd.cph.256" => "__builtin_ia32_vfmaddcph256_mask3",
1294+
"llvm.x86.avx512fp16.mask.vfcmadd.cph.128" => "__builtin_ia32_vfcmaddcph128_mask3",
1295+
"llvm.x86.avx512fp16.mask.vfmadd.cph.128" => "__builtin_ia32_vfmaddcph128_mask3",
12861296

12871297
// TODO: support the tile builtins:
12881298
"llvm.x86.ldtilecfg" => "__builtin_trap",

0 commit comments

Comments
 (0)