@@ -107,24 +107,24 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(builder: &Builder<'a, 'gcc
107107
108108 args = new_args. into ( ) ;
109109 } ,
110- "__builtin_ia32_subps512_mask" | "__builtin_ia32_subpd512_mask"
110+ "__builtin_ia32_addps512_mask" | "__builtin_ia32_addpd512_mask"
111+ | "__builtin_ia32_subps512_mask" | "__builtin_ia32_subpd512_mask"
111112 | "__builtin_ia32_mulps512_mask" | "__builtin_ia32_mulpd512_mask"
112- | "__builtin_ia32_divps512_mask" | "__builtin_ia32_divpd512_mask"
113- | "__builtin_ia32_vfmaddsubps512_mask" | "__builtin_ia32_vfmaddsubpd512_mask" => {
113+ | "__builtin_ia32_divps512_mask" | "__builtin_ia32_divpd512_mask" => {
114114 let mut new_args = args. to_vec ( ) ;
115115 let last_arg = new_args. pop ( ) . expect ( "last arg" ) ;
116+ let arg3_type = gcc_func. get_param_type ( 2 ) ;
117+ let undefined = builder. current_func ( ) . new_local ( None , arg3_type, "undefined_for_intrinsic" ) . to_rvalue ( ) ;
118+ new_args. push ( undefined) ;
116119 let arg4_type = gcc_func. get_param_type ( 3 ) ;
117120 let minus_one = builder. context . new_rvalue_from_int ( arg4_type, -1 ) ;
118121 new_args. push ( minus_one) ;
119122 new_args. push ( last_arg) ;
120123 args = new_args. into ( ) ;
121124 } ,
122- "__builtin_ia32_addps512_mask " | "__builtin_ia32_addpd512_mask " => {
125+ "__builtin_ia32_vfmaddsubps512_mask " | "__builtin_ia32_vfmaddsubpd512_mask " => {
123126 let mut new_args = args. to_vec ( ) ;
124127 let last_arg = new_args. pop ( ) . expect ( "last arg" ) ;
125- let arg3_type = gcc_func. get_param_type ( 2 ) ;
126- let undefined = builder. current_func ( ) . new_local ( None , arg3_type, "undefined_for_intrinsic" ) . to_rvalue ( ) ;
127- new_args. push ( undefined) ;
128128 let arg4_type = gcc_func. get_param_type ( 3 ) ;
129129 let minus_one = builder. context . new_rvalue_from_int ( arg4_type, -1 ) ;
130130 new_args. push ( minus_one) ;
@@ -154,7 +154,10 @@ pub fn ignore_arg_cast(func_name: &str, index: usize, args_len: usize) -> bool {
154154 return true ;
155155 }
156156 } ,
157- "__builtin_ia32_vfmaddps512_mask" => {
157+ "__builtin_ia32_vfmaddps512_mask" | "__builtin_ia32_vfmaddpd512_mask" => {
158+ // Since there are two LLVM intrinsics that map to each of these GCC builtins and only
159+ // one of them has a missing parameter before the last one, we check the number of
160+ // arguments to distinguish those cases.
158161 if args_len == 4 && index == args_len - 1 {
159162 return true ;
160163 }
@@ -217,6 +220,7 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
217220 "llvm.x86.avx512.div.ps.512" => "__builtin_ia32_divps512_mask" ,
218221 "llvm.x86.avx512.div.pd.512" => "__builtin_ia32_divpd512_mask" ,
219222 "llvm.x86.avx512.vfmadd.ps.512" => "__builtin_ia32_vfmaddps512_mask" ,
223+ "llvm.x86.avx512.vfmadd.pd.512" => "__builtin_ia32_vfmaddpd512_mask" ,
220224
221225 // The above doc points to unknown builtins for the following, so override them:
222226 "llvm.x86.avx2.gather.d.d" => "__builtin_ia32_gathersiv4si" ,
0 commit comments