Home | History | Annotate | Line # | Download | only in microblaze
      1 /* Subroutines used for the C front end for Xilinx MicroBlaze.
      2    Copyright (C) 2010-2022 Free Software Foundation, Inc.
      3 
      4    Contributed by Michael Eager <eager (at) eagercon.com>.
      5 
      6    This file is part of GCC.
      7 
      8    GCC is free software; you can redistribute it and/or modify it
      9    under the terms of the GNU General Public License as published
     10    by the Free Software Foundation; either version 3, or (at your
     11    option) any later version.
     12 
     13    GCC is distributed in the hope that it will be useful, but WITHOUT
     14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
     16    License for more details.
     17 
     18    You should have received a copy of the GNU General Public License
     19    along with GCC; see the file COPYING3.  If not see
     20    <http://www.gnu.org/licenses/>.  */
     21 
     22 #define IN_TARGET_CODE 1
     23 
     24 #include "config.h"
     25 #include "system.h"
     26 #include "coretypes.h"
     27 #include "target.h"
     28 #include "c-family/c-common.h"
     29 
     30 #define builtin_define(TXT) cpp_define (pfile, TXT)
     31 #define builtin_assert(TXT) cpp_assert (pfile, TXT)
     32 
     33 /* Define preprocessor symbols for MicroBlaze.
     34    Symbols which do not start with __ are deprecated.  */
     35 
     36 void
     37 microblaze_cpp_define (cpp_reader *pfile)
     38 {
     39   builtin_assert ("cpu=microblaze");
     40   builtin_assert ("machine=microblaze");
     41   builtin_define ("__MICROBLAZE__");
     42   builtin_define ("__microblaze__");
     43   if (TARGET_LITTLE_ENDIAN)
     44     {
     45       builtin_define ("_LITTLE_ENDIAN");
     46       builtin_define ("__LITTLE_ENDIAN__");
     47       builtin_define ("__MICROBLAZEEL__");
     48     }
     49   else
     50     {
     51       builtin_define ("_BIG_ENDIAN");
     52       builtin_define ("__BIG_ENDIAN__");
     53       builtin_define ("__MICROBLAZEEB__");
     54     }
     55   if (!TARGET_SOFT_MUL)
     56     {
     57       if (!flag_iso)
     58         builtin_define ("HAVE_HW_MUL");
     59       builtin_define ("__HAVE_HW_MUL__");
     60     }
     61   if (TARGET_MULTIPLY_HIGH)
     62     {
     63       if (!flag_iso)
     64         builtin_define ("HAVE_HW_MUL_HIGH");
     65       builtin_define ("__HAVE_HW_MUL_HIGH__");
     66     }
     67   if (!TARGET_SOFT_DIV)
     68     {
     69       if (!flag_iso)
     70         builtin_define ("HAVE_HW_DIV");
     71       builtin_define ("__HAVE_HW_DIV__");
     72     }
     73   if (TARGET_BARREL_SHIFT)
     74     {
     75       if (!flag_iso)
     76         builtin_define ("HAVE_HW_BSHIFT");
     77       builtin_define ("__HAVE_HW_BSHIFT__");
     78     }
     79   if (TARGET_PATTERN_COMPARE)
     80     {
     81       if (!flag_iso)
     82         builtin_define ("HAVE_HW_PCMP");
     83       builtin_define ("__HAVE_HW_PCMP__");
     84     }
     85   if (TARGET_HARD_FLOAT)
     86     {
     87       if (!flag_iso)
     88         builtin_define ("HAVE_HW_FPU");
     89       builtin_define ("__HAVE_HW_FPU__");
     90     }
     91   if (TARGET_FLOAT_CONVERT)
     92     {
     93       if (!flag_iso)
     94         builtin_define ("HAVE_HW_FPU_CONVERT");
     95       builtin_define ("__HAVE_HW_FPU_CONVERT__");
     96     }
     97   if (TARGET_FLOAT_SQRT)
     98     {
     99       if (!flag_iso)
    100         builtin_define ("HAVE_HW_FPU_SQRT");
    101       builtin_define ("__HAVE_HW_FPU_SQRT__");
    102     }
    103 }
    104