From 4ca4cf4e420cc817fc66949d4c8069f951d857b4 Mon Sep 17 00:00:00 2001 From: Carl Love Date: Wed, 27 Sep 2017 22:45:49 +0000 Subject: rs6000-builtin.def (BU_FP_1MISC_1): Add define macro. gcc/ChangeLog: 2017-09-27 Carl Love * config/rs6000/rs6000-builtin.def (BU_FP_1MISC_1): Add define macro. (FCTID, FCTIW): Add BU_FP_MISC_1 macro expansion for builtins. * config/rs6000/rs6000.md (lrintsfsi2): Add define_insn for the fctiw instruction. gcc/testsuite/ChangeLog: 2017-09-27 Carl Love * gcc.target/powerpc/builtin-fctid-fctiw-runnable.c: New test file for the __builtin_fctid and __builtin_fctiw. From-SVN: r253238 --- gcc/config/rs6000/rs6000-builtin.def | 14 ++++++++++++++ gcc/config/rs6000/rs6000.md | 8 ++++++++ 2 files changed, 22 insertions(+) (limited to 'gcc/config') diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 151ac64..868b0cd 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -608,6 +608,16 @@ CODE_FOR_ ## ICODE) /* ICODE */ +/* Miscellaneous builtins for instructions added prior to ISA 2.04. These + operate on floating point registers. */ +#define BU_FP_MISC_1(ENUM, NAME, ATTR, ICODE) \ + RS6000_BUILTIN_1 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \ + "__builtin_" NAME, /* NAME */ \ + RS6000_BTM_HARD_FLOAT, /* MASK */ \ + (RS6000_BTC_ ## ATTR /* ATTR */ \ + | RS6000_BTC_UNARY), \ + CODE_FOR_ ## ICODE) /* ICODE */ + /* Miscellaneous builtins for instructions added in ISA 2.06. These instructions don't require either the DFP or VSX options, just the basic ISA 2.06 (popcntd) enablement since they operate on general purpose @@ -1863,6 +1873,10 @@ BU_VSX_OVERLOAD_X (XL, "xl") BU_VSX_OVERLOAD_X (XL_BE, "xl_be") BU_VSX_OVERLOAD_X (XST, "xst") +/* 1 argument builtins pre ISA 2.04. */ +BU_FP_MISC_1 (FCTID, "fctid", CONST, lrintdfdi2) +BU_FP_MISC_1 (FCTIW, "fctiw", CONST, lrintsfsi2) + /* 2 argument CMPB instructions added in ISA 2.05. */ BU_P6_2 (CMPB_32, "cmpb_32", CONST, cmpbsi3) BU_P6_64BIT_2 (CMPB, "cmpb", CONST, cmpbdi3) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 9b10e7f..3181291 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -5915,6 +5915,14 @@ [(set_attr "type" "fpload") (set_attr "length" "16")]) +(define_insn "lrintsfsi2" + [(set (match_operand:SI 0 "gpc_reg_operand" "=d") + (unspec:SI [(match_operand:DF 1 "gpc_reg_operand" "d")] + UNSPEC_FCTIW))] + "TARGET_SF_FPR && TARGET_FPRND" + "fctiw %0,%1" + [(set_attr "type" "fp")]) + ;; No VSX equivalent to fctid (define_insn "lrintdi2" [(set (match_operand:DI 0 "gpc_reg_operand" "=d") -- cgit v1.1