S/390: Add builtins for efpc and sfpc
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>
Fri, 27 Feb 2015 10:14:20 +0000 (10:14 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Fri, 27 Feb 2015 10:14:20 +0000 (10:14 +0000)
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

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/config/s390/s390.md

index 6f2ce1988c75cca781a89d6cb8a3a185b4c36d4a..9e2e095ebc6054bd8dde7adf5879a2e4f6d1aa0c 100644 (file)
@@ -1,3 +1,12 @@
+2015-02-27  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+       * 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  <Andreas.Krebbel@de.ibm.com>
 
        * config/s390/s390.c: (enum s390_builtin, s390_expand_builtin):
index a4fb4c7522fec9a2582ed966307061c45e7e1b07..f4709da74cd7d7763152469da9416c658221449d 100644 (file)
@@ -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)
index f5ba132cc47084b4c6b96967c8331d7fa920e03d..bf698b1cf81c7d748d3d5a555b5dfee84e4c938b 100644 (file)
    UNSPECV_ETND
    UNSPECV_NTSTG
    UNSPECV_PPA
+
+   ; Set and get floating point control register
+   UNSPECV_SFPC
+   UNSPECV_EFPC
   ])
 
 ;;
   "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")