summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorfjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-30 20:59:21 +0000
committerfjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-30 20:59:21 +0000
commitd0405f40de0e3c7796e93d22cf20737aa79b9349 (patch)
treedc8bee2ade4f014827f574e15ef69b4b8b8775b7 /gcc/builtins.c
parent82e95be3b8242fdda13db619bc316f1c36aa2488 (diff)
downloadgcc-d0405f40de0e3c7796e93d22cf20737aa79b9349.tar.gz
Fix problem with calling powi* builtins.
OKed by Richard Henderson. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97278 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 68b91c56772..fb044de52ac 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2380,6 +2380,7 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget)
tree arg0, arg1;
rtx op0, op1;
enum machine_mode mode;
+ enum machine_mode mode2;
if (! validate_arglist (arglist, REAL_TYPE, INTEGER_TYPE, VOID_TYPE))
return 0;
@@ -2411,19 +2412,22 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget)
/* Emit a libcall to libgcc. */
+ /* Mode of the 2nd argument must match that of an int. */
+ mode2 = mode_for_size (INT_TYPE_SIZE, MODE_INT, 0);
+
if (target == NULL_RTX)
target = gen_reg_rtx (mode);
op0 = expand_expr (arg0, subtarget, mode, 0);
if (GET_MODE (op0) != mode)
op0 = convert_to_mode (mode, op0, 0);
- op1 = expand_expr (arg1, 0, word_mode, 0);
- if (GET_MODE (op1) != word_mode)
- op1 = convert_to_mode (word_mode, op1, 0);
+ op1 = expand_expr (arg1, 0, mode2, 0);
+ if (GET_MODE (op1) != mode2)
+ op1 = convert_to_mode (mode2, op1, 0);
target = emit_library_call_value (powi_optab->handlers[(int) mode].libfunc,
target, LCT_CONST_MAKE_BLOCK, mode, 2,
- op0, mode, op1, word_mode);
+ op0, mode, op1, mode2);
return target;
}