From: Andreas Krebbel Date: Fri, 27 Feb 2015 10:14:20 +0000 (+0000) Subject: S/390: Add builtins for efpc and sfpc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=004f64e1b05a568d974669c41a5c0f1af77914de;p=gcc.git S/390: Add builtins for efpc and sfpc gcc/ChangeLog: * config/s390/s390.c (enum s390_builtin): Add S390_BUILTIN_S390_SFPC and S390_BUILTIN_S390_EFPC. (code_for_builtin): Add CODE_FOR_s390_sfpc and CODE_FOR_s390_efpc. (s390_init_builtins): Generate new builtin functions. * config/s390/s390.md (UNSPECV_SFPC, UNSPECV_EFPC): New constants. (s390_sfpc, s390_efpc): New pattern definitions. From-SVN: r221047 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f2ce1988c7..9e2e095ebc6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-02-27 Andreas Krebbel + + * config/s390/s390.c (enum s390_builtin): + Add S390_BUILTIN_S390_SFPC and S390_BUILTIN_S390_EFPC. + (code_for_builtin): Add CODE_FOR_s390_sfpc and CODE_FOR_s390_efpc. + (s390_init_builtins): Generate new builtin functions. + * config/s390/s390.md (UNSPECV_SFPC, UNSPECV_EFPC): New constants. + (s390_sfpc, s390_efpc): New pattern definitions. + 2015-02-27 Andreas Krebbel * config/s390/s390.c: (enum s390_builtin, s390_expand_builtin): diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index a4fb4c7522f..f4709da74cd 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -9982,6 +9982,9 @@ enum s390_builtin S390_BUILTIN_TX_NESTING_DEPTH, S390_BUILTIN_TX_ASSIST, + S390_BUILTIN_S390_SFPC, + S390_BUILTIN_S390_EFPC, + S390_BUILTIN_MAX }; @@ -9997,7 +10000,10 @@ static enum insn_code const code_for_builtin[S390_BUILTIN_MAX] = { CODE_FOR_tabort, CODE_FOR_ntstg, CODE_FOR_etnd, - CODE_FOR_tx_assist + CODE_FOR_tx_assist, + + CODE_FOR_s390_sfpc, + CODE_FOR_s390_efpc }; static void @@ -10025,6 +10031,12 @@ s390_init_builtins (void) add_builtin_function ("__builtin_tx_assist", ftype, S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE); + /* void foo (unsigned) */ + ftype = build_function_type_list (void_type_node, unsigned_type_node, + NULL_TREE); + s390_builtin_decls[S390_BUILTIN_S390_SFPC] = + add_builtin_function ("__builtin_s390_sfpc", ftype, + S390_BUILTIN_S390_SFPC, BUILT_IN_MD, NULL, NULL_TREE); /* int foo (void *) */ ftype = build_function_type_list (integer_type_node, ptr_type_node, @@ -10061,6 +10073,11 @@ s390_init_builtins (void) add_builtin_function ("__builtin_tend", ftype, S390_BUILTIN_TEND, BUILT_IN_MD, NULL, NULL_TREE); + /* unsigned foo (void) */ + ftype = build_function_type_list (unsigned_type_node, NULL_TREE); + s390_builtin_decls[S390_BUILTIN_S390_EFPC] = + add_builtin_function ("__builtin_s390_efpc", ftype, + S390_BUILTIN_S390_EFPC, BUILT_IN_MD, NULL, NULL_TREE); /* void foo (uint64_t *, uint64_t) */ if (TARGET_64BIT) diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index f5ba132cc47..bf698b1cf81 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -162,6 +162,10 @@ UNSPECV_ETND UNSPECV_NTSTG UNSPECV_PPA + + ; Set and get floating point control register + UNSPECV_SFPC + UNSPECV_EFPC ]) ;; @@ -10300,3 +10304,18 @@ "TARGET_HTM && INTVAL (operands[2]) < 16" "ppa\t%0,%1,%2" [(set_attr "op_type" "RRF")]) + + +; Set and get floating point control register + +(define_insn "s390_sfpc" + [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")] + UNSPECV_SFPC)] + "TARGET_HARD_FLOAT" + "sfpc\t%0") + +(define_insn "s390_efpc" + [(set (match_operand:SI 0 "register_operand" "=d") + (unspec_volatile:SI [(const_int 0)] UNSPECV_EFPC))] + "TARGET_HARD_FLOAT" + "efpc\t%0")