]>
Commit | Line | Data |
---|---|---|
462f85ce RS |
1 | /* Target-dependent costs for expmed.c. |
2 | Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | |
3 | 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | |
4 | Free Software Foundation, Inc. | |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 3, or (at your option; any later | |
11 | version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | 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 | #ifndef EXPMED_H | |
23 | #define EXPMED_H 1 | |
24 | ||
25 | /* Target-dependent globals. */ | |
26 | struct target_expmed { | |
27 | /* Nonzero means divides or modulus operations are relatively cheap for | |
28 | powers of two, so don't use branches; emit the operation instead. | |
29 | Usually, this will mean that the MD file will emit non-branch | |
30 | sequences. */ | |
31 | bool x_sdiv_pow2_cheap[2][NUM_MACHINE_MODES]; | |
32 | bool x_smod_pow2_cheap[2][NUM_MACHINE_MODES]; | |
33 | ||
34 | /* Cost of various pieces of RTL. Note that some of these are indexed by | |
35 | shift count and some by mode. */ | |
36 | int x_zero_cost[2]; | |
37 | int x_add_cost[2][NUM_MACHINE_MODES]; | |
38 | int x_neg_cost[2][NUM_MACHINE_MODES]; | |
39 | int x_shift_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD]; | |
40 | int x_shiftadd_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD]; | |
41 | int x_shiftsub0_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD]; | |
42 | int x_shiftsub1_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD]; | |
43 | int x_mul_cost[2][NUM_MACHINE_MODES]; | |
44 | int x_sdiv_cost[2][NUM_MACHINE_MODES]; | |
45 | int x_udiv_cost[2][NUM_MACHINE_MODES]; | |
46 | int x_mul_widen_cost[2][NUM_MACHINE_MODES]; | |
47 | int x_mul_highpart_cost[2][NUM_MACHINE_MODES]; | |
48 | }; | |
49 | ||
50 | extern struct target_expmed default_target_expmed; | |
51 | #if SWITCHABLE_TARGET | |
52 | extern struct target_expmed *this_target_expmed; | |
53 | #else | |
54 | #define this_target_expmed (&default_target_expmed) | |
55 | #endif | |
56 | ||
57 | #define sdiv_pow2_cheap \ | |
58 | (this_target_expmed->x_sdiv_pow2_cheap) | |
59 | #define smod_pow2_cheap \ | |
60 | (this_target_expmed->x_smod_pow2_cheap) | |
61 | #define zero_cost \ | |
62 | (this_target_expmed->x_zero_cost) | |
63 | #define add_cost \ | |
64 | (this_target_expmed->x_add_cost) | |
65 | #define neg_cost \ | |
66 | (this_target_expmed->x_neg_cost) | |
67 | #define shift_cost \ | |
68 | (this_target_expmed->x_shift_cost) | |
69 | #define shiftadd_cost \ | |
70 | (this_target_expmed->x_shiftadd_cost) | |
71 | #define shiftsub0_cost \ | |
72 | (this_target_expmed->x_shiftsub0_cost) | |
73 | #define shiftsub1_cost \ | |
74 | (this_target_expmed->x_shiftsub1_cost) | |
75 | #define mul_cost \ | |
76 | (this_target_expmed->x_mul_cost) | |
77 | #define sdiv_cost \ | |
78 | (this_target_expmed->x_sdiv_cost) | |
79 | #define udiv_cost \ | |
80 | (this_target_expmed->x_udiv_cost) | |
81 | #define mul_widen_cost \ | |
82 | (this_target_expmed->x_mul_widen_cost) | |
83 | #define mul_highpart_cost \ | |
84 | (this_target_expmed->x_mul_highpart_cost) | |
85 | ||
86 | #endif |