1 /* intrinsics.cc -- D language compiler intrinsics.
2 Copyright (C) 2006-2020 Free Software Foundation, Inc.
4 GCC is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
9 GCC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with GCC; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>. */
20 #include "coretypes.h"
22 #include "dmd/declaration.h"
23 #include "dmd/identifier.h"
24 #include "dmd/mangle.h"
25 #include "dmd/mangle.h"
26 #include "dmd/module.h"
27 #include "dmd/template.h"
32 #include "fold-const.h"
33 #include "stringpool.h"
39 /* An internal struct used to hold information on D intrinsics. */
43 /* The DECL_INTRINSIC_CODE of this decl. */
46 /* The DECL_FUNCTION_CODE of this decl, if it directly maps to any. */
47 built_in_function built_in
;
49 /* The name of the intrinsic. */
52 /* The module where the intrinsic is located. */
55 /* The mangled signature decoration of the intrinsic. */
58 /* True if the intrinsic is only handled in CTFE. */
62 static const intrinsic_decl intrinsic_decls
[] =
64 #define DEF_D_INTRINSIC(CODE, BUILTIN, NAME, MODULE, DECO, CTFE) \
65 { INTRINSIC_ ## CODE, BUILT_IN_ ## BUILTIN, NAME, MODULE, DECO, CTFE },
67 #include "intrinsics.def"
69 #undef DEF_D_INTRINSIC
72 /* Checks if DECL is an intrinsic or run time library function that requires
73 special processing. Sets DECL_INTRINSIC_CODE so it can be identified
74 later in maybe_expand_intrinsic. */
77 maybe_set_intrinsic (FuncDeclaration
*decl
)
79 if (!decl
->ident
|| decl
->builtin
!= BUILTINunknown
)
82 /* The builtin flag is updated only if we can evaluate the intrinsic
83 at compile-time. Such as the math or bitop intrinsics. */
84 decl
->builtin
= BUILTINno
;
86 /* Check if it's a compiler intrinsic. We only require that any
87 internally recognised intrinsics are declared in a module with
88 an explicit module declaration. */
89 Module
*m
= decl
->getModule ();
94 TemplateInstance
*ti
= decl
->isInstantiated ();
95 TemplateDeclaration
*td
= ti
? ti
->tempdecl
->isTemplateDeclaration () : NULL
;
97 const char *tname
= decl
->ident
->toChars ();
98 const char *tmodule
= m
->md
->toChars ();
99 const char *tdeco
= (td
== NULL
) ? decl
->type
->deco
: NULL
;
101 /* Look through all D intrinsics. */
102 for (size_t i
= 0; i
< (int) INTRINSIC_LAST
; i
++)
104 if (!intrinsic_decls
[i
].name
)
107 if (strcmp (intrinsic_decls
[i
].name
, tname
) != 0
108 || strcmp (intrinsic_decls
[i
].module
, tmodule
) != 0)
111 /* Instantiated functions would have the wrong type deco, get it from the
112 template member instead. */
115 if (!td
|| !td
->onemember
)
118 FuncDeclaration
*fd
= td
->onemember
->isFuncDeclaration ();
123 mangleToBuffer (fd
->type
, &buf
);
124 tdeco
= buf
.extractChars ();
127 /* Matching the type deco may be a bit too strict, as it means that all
128 function attributes that end up in the signature must be kept aligned
129 between the compiler and library declaration. */
130 if (strcmp (intrinsic_decls
[i
].deco
, tdeco
) == 0)
132 intrinsic_code code
= intrinsic_decls
[i
].code
;
134 if (decl
->csym
== NULL
)
135 get_symbol_decl (decl
);
137 /* If there is no function body, then the implementation is always
138 provided by the compiler. */
140 set_decl_built_in_function (decl
->csym
, BUILT_IN_FRONTEND
, code
);
142 /* Infer whether the intrinsic can be used for CTFE, let the
143 front-end know that it can be evaluated at compile-time. */
146 case INTRINSIC_VA_ARG
:
147 case INTRINSIC_C_VA_ARG
:
148 case INTRINSIC_VASTART
:
150 case INTRINSIC_ADDSL
:
152 case INTRINSIC_ADDUL
:
154 case INTRINSIC_SUBSL
:
156 case INTRINSIC_SUBUL
:
158 case INTRINSIC_MULSL
:
160 case INTRINSIC_MULUI
:
161 case INTRINSIC_MULUL
:
163 case INTRINSIC_NEGSL
:
164 case INTRINSIC_VLOAD8
:
165 case INTRINSIC_VLOAD16
:
166 case INTRINSIC_VLOAD32
:
167 case INTRINSIC_VLOAD64
:
168 case INTRINSIC_VSTORE8
:
169 case INTRINSIC_VSTORE16
:
170 case INTRINSIC_VSTORE32
:
171 case INTRINSIC_VSTORE64
:
176 /* Check that this overload of pow() is has an equivalent
177 built-in function. It could be `int pow(int, int)'. */
178 tree rettype
= TREE_TYPE (TREE_TYPE (decl
->csym
));
179 if (mathfn_built_in (rettype
, BUILT_IN_POW
) != NULL_TREE
)
180 decl
->builtin
= BUILTINyes
;
185 decl
->builtin
= BUILTINyes
;
189 /* The intrinsic was marked as CTFE-only. */
190 if (intrinsic_decls
[i
].ctfeonly
)
191 DECL_BUILT_IN_CTFE (decl
->csym
) = 1;
193 DECL_INTRINSIC_CODE (decl
->csym
) = code
;
199 /* Construct a function call to the built-in function CODE, N is the number of
200 arguments, and the `...' parameters are the argument expressions.
201 The original call expression is held in CALLEXP. */
204 call_builtin_fn (tree callexp
, built_in_function code
, int n
, ...)
206 tree
*argarray
= XALLOCAVEC (tree
, n
);
210 for (int i
= 0; i
< n
; i
++)
211 argarray
[i
] = va_arg (ap
, tree
);
214 tree exp
= build_call_expr_loc_array (EXPR_LOCATION (callexp
),
215 builtin_decl_explicit (code
),
217 return convert (TREE_TYPE (callexp
), fold (exp
));
220 /* Expand a front-end instrinsic call to bsf(). This takes one argument,
221 the signature to which can be either:
226 This scans all bits in the given argument starting with the first,
227 returning the bit number of the first bit set. The original call
228 expression is held in CALLEXP. */
231 expand_intrinsic_bsf (tree callexp
)
233 /* The bsr() intrinsic gets turned into __builtin_ctz(arg).
234 The return value is supposed to be undefined if arg is zero. */
235 tree arg
= CALL_EXPR_ARG (callexp
, 0);
236 int argsize
= TYPE_PRECISION (TREE_TYPE (arg
));
238 /* Which variant of __builtin_ctz* should we call? */
239 built_in_function code
= (argsize
<= INT_TYPE_SIZE
) ? BUILT_IN_CTZ
240 : (argsize
<= LONG_TYPE_SIZE
) ? BUILT_IN_CTZL
241 : (argsize
<= LONG_LONG_TYPE_SIZE
) ? BUILT_IN_CTZLL
244 gcc_assert (code
!= END_BUILTINS
);
246 return call_builtin_fn (callexp
, code
, 1, arg
);
249 /* Expand a front-end instrinsic call to bsr(). This takes one argument,
250 the signature to which can be either:
255 This scans all bits in the given argument from the most significant bit
256 to the least significant, returning the bit number of the first bit set.
257 The original call expression is held in CALLEXP. */
260 expand_intrinsic_bsr (tree callexp
)
262 /* The bsr() intrinsic gets turned into (size - 1) - __builtin_clz(arg).
263 The return value is supposed to be undefined if arg is zero. */
264 tree arg
= CALL_EXPR_ARG (callexp
, 0);
265 tree type
= TREE_TYPE (arg
);
266 int argsize
= TYPE_PRECISION (type
);
268 /* Which variant of __builtin_clz* should we call? */
269 built_in_function code
= (argsize
<= INT_TYPE_SIZE
) ? BUILT_IN_CLZ
270 : (argsize
<= LONG_TYPE_SIZE
) ? BUILT_IN_CLZL
271 : (argsize
<= LONG_LONG_TYPE_SIZE
) ? BUILT_IN_CLZLL
274 gcc_assert (code
!= END_BUILTINS
);
276 tree result
= call_builtin_fn (callexp
, code
, 1, arg
);
278 /* Handle int -> long conversions. */
279 if (TREE_TYPE (result
) != type
)
280 result
= fold_convert (type
, result
);
282 result
= fold_build2 (MINUS_EXPR
, type
,
283 build_integer_cst (argsize
- 1, type
), result
);
284 return fold_convert (TREE_TYPE (callexp
), result
);
287 /* Expand a front-end intrinsic call to INTRINSIC, which is either a call to
288 bt(), btc(), btr(), or bts(). These intrinsics expect to take two arguments,
289 the signature to which is:
291 int bt (size_t* ptr, size_t bitnum);
293 All intrinsics test if a bit is set and return the result of that condition.
294 Variants of `bt' will then update that bit. `btc' compliments the bit, `bts'
295 sets the bit, and `btr' resets the bit. The original call expression is
299 expand_intrinsic_bt (intrinsic_code intrinsic
, tree callexp
)
301 tree ptr
= CALL_EXPR_ARG (callexp
, 0);
302 tree bitnum
= CALL_EXPR_ARG (callexp
, 1);
303 tree type
= TREE_TYPE (TREE_TYPE (ptr
));
305 /* size_t bitsize = sizeof(*ptr) * BITS_PER_UNIT; */
306 tree bitsize
= fold_convert (type
, TYPE_SIZE (type
));
308 /* ptr[bitnum / bitsize] */
309 ptr
= build_array_index (ptr
, fold_build2 (TRUNC_DIV_EXPR
, type
,
311 ptr
= indirect_ref (type
, ptr
);
313 /* mask = 1 << (bitnum % bitsize); */
314 bitnum
= fold_build2 (TRUNC_MOD_EXPR
, type
, bitnum
, bitsize
);
315 bitnum
= fold_build2 (LSHIFT_EXPR
, type
, size_one_node
, bitnum
);
317 /* cond = ptr[bitnum / size] & mask; */
318 tree cond
= fold_build2 (BIT_AND_EXPR
, type
, ptr
, bitnum
);
321 cond
= build_condition (TREE_TYPE (callexp
), d_truthvalue_conversion (cond
),
322 integer_minus_one_node
, integer_zero_node
);
324 /* Update the bit as needed, only testing the bit for bt(). */
334 case INTRINSIC_BTC64
:
339 case INTRINSIC_BTR64
:
340 bitnum
= fold_build1 (BIT_NOT_EXPR
, TREE_TYPE (bitnum
), bitnum
);
345 case INTRINSIC_BTS64
:
353 /* ptr[bitnum / size] op= mask; */
354 if (intrinsic
== INTRINSIC_BTR
)
355 bitnum
= fold_build1 (BIT_NOT_EXPR
, TREE_TYPE (bitnum
), bitnum
);
357 ptr
= modify_expr (ptr
, fold_build2 (code
, TREE_TYPE (ptr
), ptr
, bitnum
));
359 /* Store the condition result in a temporary, and return expressions in
360 correct order of evaluation. */
361 tree tmp
= build_local_temp (TREE_TYPE (callexp
));
362 cond
= modify_expr (tmp
, cond
);
364 return compound_expr (cond
, compound_expr (ptr
, tmp
));
367 /* Expand a front-end intrinsic call to popcnt(). This takes one argument, the
368 signature to which can be either:
370 int popcnt (uint arg);
371 int popcnt (ulong arg);
373 Calculates the number of set bits in an integer. The original call
374 expression is held in CALLEXP. */
377 expand_intrinsic_popcnt (tree callexp
)
379 tree arg
= CALL_EXPR_ARG (callexp
, 0);
380 int argsize
= TYPE_PRECISION (TREE_TYPE (arg
));
382 /* Which variant of __builtin_popcount* should we call? */
383 built_in_function code
= (argsize
<= INT_TYPE_SIZE
) ? BUILT_IN_POPCOUNT
384 : (argsize
<= LONG_TYPE_SIZE
) ? BUILT_IN_POPCOUNTL
385 : (argsize
<= LONG_LONG_TYPE_SIZE
) ? BUILT_IN_POPCOUNTLL
388 gcc_assert (code
!= END_BUILTINS
);
390 return call_builtin_fn (callexp
, code
, 1, arg
);
393 /* Expand a front-end intrinsic call to copysign(). This takes two arguments,
394 the signature to which can be either:
396 float copysign (T to, float from);
397 double copysign (T to, double from);
398 real copysign (T to, real from);
400 This computes a value composed of TO with the sign bit of FROM. The original
401 call expression is held in CALLEXP. */
404 expand_intrinsic_copysign (tree callexp
)
406 tree to
= CALL_EXPR_ARG (callexp
, 0);
407 tree from
= CALL_EXPR_ARG (callexp
, 1);
408 tree type
= TREE_TYPE (to
);
410 /* Convert parameters to the same type. Prefer the first parameter unless it
411 is an integral type. */
412 if (INTEGRAL_TYPE_P (type
))
414 to
= fold_convert (TREE_TYPE (from
), to
);
415 type
= TREE_TYPE (to
);
418 from
= fold_convert (type
, from
);
420 /* Which variant of __builtin_copysign* should we call? */
421 tree builtin
= mathfn_built_in (type
, BUILT_IN_COPYSIGN
);
422 gcc_assert (builtin
!= NULL_TREE
);
424 return call_builtin_fn (callexp
, DECL_FUNCTION_CODE (builtin
), 2,
428 /* Expand a front-end intrinsic call to pow(). This takes two arguments, the
429 signature to which can be either:
431 float pow (float base, T exponent);
432 double pow (double base, T exponent);
433 real pow (real base, T exponent);
435 This computes the value of BASE raised to the power of EXPONENT.
436 The original call expression is held in CALLEXP. */
439 expand_intrinsic_pow (tree callexp
)
441 tree base
= CALL_EXPR_ARG (callexp
, 0);
442 tree exponent
= CALL_EXPR_ARG (callexp
, 1);
443 tree exptype
= TREE_TYPE (exponent
);
445 /* Which variant of __builtin_pow* should we call? */
446 built_in_function code
= SCALAR_FLOAT_TYPE_P (exptype
) ? BUILT_IN_POW
447 : INTEGRAL_TYPE_P (exptype
) ? BUILT_IN_POWI
449 gcc_assert (code
!= END_BUILTINS
);
451 tree builtin
= mathfn_built_in (TREE_TYPE (base
), code
);
452 gcc_assert (builtin
!= NULL_TREE
);
454 return call_builtin_fn (callexp
, DECL_FUNCTION_CODE (builtin
), 2,
458 /* Expand a front-end intrinsic call to toPrec(). This takes one argument, the
459 signature to which can be either:
461 T toPrec(T)(float f);
462 T toPrec(T)(double f);
465 This rounds the argument F to the precision of the specified floating
466 point type T. The original call expression is held in CALLEXP. */
469 expand_intrinsic_toprec (tree callexp
)
471 tree f
= CALL_EXPR_ARG (callexp
, 0);
472 tree type
= TREE_TYPE (callexp
);
474 return convert (type
, f
);
477 /* Expand a front-end intrinsic call to va_arg(). This takes either one or two
478 arguments, the signature to which can be either:
480 T va_arg(T) (ref va_list ap);
481 void va_arg(T) (va_list ap, ref T parmn);
483 This retrieves the next variadic parameter that is type T from the given
484 va_list. If also given, store the value into parmn, otherwise return it.
485 The original call expression is held in CALLEXP. */
488 expand_intrinsic_vaarg (tree callexp
)
490 tree ap
= CALL_EXPR_ARG (callexp
, 0);
491 tree parmn
= NULL_TREE
;
496 if (call_expr_nargs (callexp
) == 1)
497 type
= TREE_TYPE (callexp
);
500 parmn
= CALL_EXPR_ARG (callexp
, 1);
502 gcc_assert (TREE_CODE (parmn
) == ADDR_EXPR
);
503 parmn
= TREE_OPERAND (parmn
, 0);
504 type
= TREE_TYPE (parmn
);
507 /* (T) VA_ARG_EXP<ap>; */
508 tree exp
= build1 (VA_ARG_EXPR
, type
, ap
);
510 /* parmn = (T) VA_ARG_EXP<ap>; */
511 if (parmn
!= NULL_TREE
)
512 exp
= modify_expr (parmn
, exp
);
517 /* Expand a front-end intrinsic call to va_start(), which takes two arguments,
518 the signature to which is:
520 void va_start(T) (out va_list ap, ref T parmn);
522 This initializes the va_list type, where parmn should be the last named
523 parameter. The original call expression is held in CALLEXP. */
526 expand_intrinsic_vastart (tree callexp
)
528 tree ap
= CALL_EXPR_ARG (callexp
, 0);
529 tree parmn
= CALL_EXPR_ARG (callexp
, 1);
534 /* The va_list argument should already have its address taken. The second
535 argument, however, is inout and that needs to be fixed to prevent a
536 warning. Could be casting, so need to check type too? */
537 gcc_assert (TREE_CODE (ap
) == ADDR_EXPR
&& TREE_CODE (parmn
) == ADDR_EXPR
);
539 /* Assuming nobody tries to change the return type. */
540 parmn
= TREE_OPERAND (parmn
, 0);
542 return call_builtin_fn (callexp
, BUILT_IN_VA_START
, 2, ap
, parmn
);
545 /* Expand a front-end instrinsic call to INTRINSIC, which is either a call to
546 adds(), addu(), subs(), subu(), negs(), muls(), or mulu(). These intrinsics
547 expect to take two or three arguments, the signature to which can be either:
549 int adds (int x, int y, ref bool overflow);
550 long adds (long x, long y, ref bool overflow);
551 int negs (int x, ref bool overflow);
552 long negs (long x, ref bool overflow);
554 This performs an operation on two signed or unsigned integers, checking for
555 overflow. The overflow is sticky, meaning that a sequence of operations
556 can be done and overflow need only be checked at the end. The original call
557 expression is held in CALLEXP. */
560 expand_intrinsic_checkedint (intrinsic_code intrinsic
, tree callexp
)
562 tree type
= TREE_TYPE (callexp
);
568 /* Which variant of *_OVERFLOW should we generate? */
572 case INTRINSIC_ADDSL
:
574 case INTRINSIC_ADDUL
:
575 x
= CALL_EXPR_ARG (callexp
, 0);
576 y
= CALL_EXPR_ARG (callexp
, 1);
577 overflow
= CALL_EXPR_ARG (callexp
, 2);
578 icode
= IFN_ADD_OVERFLOW
;
582 case INTRINSIC_SUBSL
:
584 case INTRINSIC_SUBUL
:
585 x
= CALL_EXPR_ARG (callexp
, 0);
586 y
= CALL_EXPR_ARG (callexp
, 1);
587 overflow
= CALL_EXPR_ARG (callexp
, 2);
588 icode
= IFN_SUB_OVERFLOW
;
592 case INTRINSIC_MULSL
:
594 case INTRINSIC_MULUI
:
595 case INTRINSIC_MULUL
:
596 x
= CALL_EXPR_ARG (callexp
, 0);
597 y
= CALL_EXPR_ARG (callexp
, 1);
598 overflow
= CALL_EXPR_ARG (callexp
, 2);
599 icode
= IFN_MUL_OVERFLOW
;
603 case INTRINSIC_NEGSL
:
604 /* The negs() intrinsic gets turned into SUB_OVERFLOW (0, y). */
605 x
= fold_convert (type
, integer_zero_node
);
606 y
= CALL_EXPR_ARG (callexp
, 0);
607 overflow
= CALL_EXPR_ARG (callexp
, 1);
608 icode
= IFN_SUB_OVERFLOW
;
616 = build_call_expr_internal_loc (EXPR_LOCATION (callexp
), icode
,
617 build_complex_type (type
), 2, x
, y
);
619 STRIP_NOPS (overflow
);
620 overflow
= build_deref (overflow
);
622 /* Assign returned result to overflow parameter, however if overflow is
623 already true, maintain its value. */
624 type
= TREE_TYPE (overflow
);
625 result
= save_expr (result
);
627 tree exp
= fold_build2 (BIT_IOR_EXPR
, type
, overflow
,
628 fold_convert (type
, imaginary_part (result
)));
629 exp
= modify_expr (overflow
, exp
);
631 /* Return the value of result. */
632 return compound_expr (exp
, real_part (result
));
635 /* Expand a front-end instrinsic call to volatileLoad(). This takes one
636 argument, the signature to which can be either:
638 ubyte volatileLoad (ubyte* ptr);
639 ushort volatileLoad (ushort* ptr);
640 uint volatileLoad (uint* ptr);
641 ulong volatileLoad (ulong* ptr);
643 This reads a value from the memory location indicated by ptr. Calls to
644 them are be guaranteed to not be removed (such as during DCE) or reordered
645 in the same thread. The original call expression is held in CALLEXP. */
648 expand_volatile_load (tree callexp
)
650 tree ptr
= CALL_EXPR_ARG (callexp
, 0);
651 tree ptrtype
= TREE_TYPE (ptr
);
652 gcc_assert (POINTER_TYPE_P (ptrtype
));
654 /* (T) *(volatile T *) ptr; */
655 tree type
= build_qualified_type (TREE_TYPE (ptrtype
), TYPE_QUAL_VOLATILE
);
656 tree result
= indirect_ref (type
, ptr
);
657 TREE_THIS_VOLATILE (result
) = 1;
662 /* Expand a front-end instrinsic call to volatileStore(). This takes two
663 arguments, the signature to which can be either:
665 void volatileStore (ubyte* ptr, ubyte value);
666 void volatileStore (ushort* ptr, ushort value);
667 void volatileStore (uint* ptr, uint value);
668 void volatileStore (ulong* ptr, ulong value);
670 This writes a value to the memory location indicated by ptr. Calls to
671 them are be guaranteed to not be removed (such as during DCE) or reordered
672 in the same thread. The original call expression is held in CALLEXP. */
675 expand_volatile_store (tree callexp
)
677 tree ptr
= CALL_EXPR_ARG (callexp
, 0);
678 tree ptrtype
= TREE_TYPE (ptr
);
679 gcc_assert (POINTER_TYPE_P (ptrtype
));
681 /* (T) *(volatile T *) ptr; */
682 tree type
= build_qualified_type (TREE_TYPE (ptrtype
), TYPE_QUAL_VOLATILE
);
683 tree result
= indirect_ref (type
, ptr
);
684 TREE_THIS_VOLATILE (result
) = 1;
686 /* (*(volatile T *) ptr) = value; */
687 tree value
= CALL_EXPR_ARG (callexp
, 1);
688 return modify_expr (result
, value
);
691 /* If CALLEXP is for an intrinsic , expand and return inlined compiler
692 generated instructions. Most map directly to GCC builtins, others
693 require a little extra work around them. */
696 maybe_expand_intrinsic (tree callexp
)
698 tree callee
= CALL_EXPR_FN (callexp
);
700 if (TREE_CODE (callee
) == ADDR_EXPR
)
701 callee
= TREE_OPERAND (callee
, 0);
703 if (TREE_CODE (callee
) != FUNCTION_DECL
)
706 /* Don't expand CTFE-only intrinsics outside of semantic processing. */
707 if (DECL_BUILT_IN_CTFE (callee
) && !doing_semantic_analysis_p
)
710 intrinsic_code intrinsic
= DECL_INTRINSIC_CODE (callee
);
711 built_in_function code
;
719 case INTRINSIC_BSF64
:
720 return expand_intrinsic_bsf (callexp
);
723 case INTRINSIC_BSR64
:
724 return expand_intrinsic_bsr (callexp
);
729 case INTRINSIC_BTC64
:
731 case INTRINSIC_BTR64
:
733 case INTRINSIC_BTS64
:
734 return expand_intrinsic_bt (intrinsic
, callexp
);
736 case INTRINSIC_POPCNT32
:
737 case INTRINSIC_POPCNT64
:
738 return expand_intrinsic_popcnt (callexp
);
740 case INTRINSIC_BSWAP32
:
741 case INTRINSIC_BSWAP64
:
743 case INTRINSIC_CEILF
:
744 case INTRINSIC_CEILL
:
748 case INTRINSIC_EXPM1
:
749 case INTRINSIC_FABSL
:
750 case INTRINSIC_FLOOR
:
751 case INTRINSIC_FLOORF
:
752 case INTRINSIC_FLOORL
:
753 case INTRINSIC_ISFINITE
:
754 case INTRINSIC_ISINFINITY
:
755 case INTRINSIC_ISNAN
:
757 case INTRINSIC_LOG10
:
759 case INTRINSIC_RINTL
:
760 case INTRINSIC_RNDTOLL
:
761 case INTRINSIC_ROUND
:
764 case INTRINSIC_SQRTF
:
765 case INTRINSIC_SQRTL
:
767 case INTRINSIC_TRUNC
:
768 code
= intrinsic_decls
[intrinsic
].built_in
;
769 gcc_assert (code
!= BUILT_IN_NONE
);
770 return call_builtin_fn (callexp
, code
, 1,
771 CALL_EXPR_ARG (callexp
, 0));
775 case INTRINSIC_LDEXPL
:
776 code
= intrinsic_decls
[intrinsic
].built_in
;
777 gcc_assert (code
!= BUILT_IN_NONE
);
778 return call_builtin_fn (callexp
, code
, 2,
779 CALL_EXPR_ARG (callexp
, 0),
780 CALL_EXPR_ARG (callexp
, 1));
783 code
= intrinsic_decls
[intrinsic
].built_in
;
784 gcc_assert (code
!= BUILT_IN_NONE
);
785 return call_builtin_fn (callexp
, code
, 3,
786 CALL_EXPR_ARG (callexp
, 0),
787 CALL_EXPR_ARG (callexp
, 1),
788 CALL_EXPR_ARG (callexp
, 2));
790 case INTRINSIC_COPYSIGN
:
791 case INTRINSIC_COPYSIGNI
:
792 return expand_intrinsic_copysign (callexp
);
795 return expand_intrinsic_pow (callexp
);
797 case INTRINSIC_TOPREC
:
798 case INTRINSIC_TOPRECF
:
799 case INTRINSIC_TOPRECL
:
800 return expand_intrinsic_toprec (callexp
);
802 case INTRINSIC_VA_ARG
:
803 case INTRINSIC_C_VA_ARG
:
804 return expand_intrinsic_vaarg (callexp
);
806 case INTRINSIC_VASTART
:
807 return expand_intrinsic_vastart (callexp
);
810 case INTRINSIC_ADDSL
:
812 case INTRINSIC_ADDUL
:
814 case INTRINSIC_SUBSL
:
816 case INTRINSIC_SUBUL
:
818 case INTRINSIC_MULSL
:
820 case INTRINSIC_MULUI
:
821 case INTRINSIC_MULUL
:
823 case INTRINSIC_NEGSL
:
824 return expand_intrinsic_checkedint (intrinsic
, callexp
);
826 case INTRINSIC_VLOAD8
:
827 case INTRINSIC_VLOAD16
:
828 case INTRINSIC_VLOAD32
:
829 case INTRINSIC_VLOAD64
:
830 return expand_volatile_load (callexp
);
832 case INTRINSIC_VSTORE8
:
833 case INTRINSIC_VSTORE16
:
834 case INTRINSIC_VSTORE32
:
835 case INTRINSIC_VSTORE64
:
836 return expand_volatile_store (callexp
);