• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン9dd4c6b827fb6dfe071a779a17eb67b31daff7fb (tree)
日時2015-03-05 23:51:33
作者Yoshinori Sato <ysato@sa76...>
コミッターYoshinori Sato

ログメッセージ

Add h8300-*-linux target

変更サマリ

差分

--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1213,6 +1213,10 @@ h8300-*-elf*)
12131213 tmake_file="h8300/t-h8300"
12141214 tm_file="h8300/h8300.h dbxelf.h elfos.h newlib-stdint.h h8300/elf.h"
12151215 ;;
1216+h8300-*-linux*)
1217+ tmake_file="${tmake_file} h8300/t-h8300 h8300/t-linux"
1218+ tm_file="h8300/h8300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h h8300/linux.h"
1219+ ;;
12161220 hppa*64*-*-linux*)
12171221 target_cpu_default="MASK_PA_11|MASK_PA_20"
12181222 tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h gnu-user.h linux.h \
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -370,6 +370,11 @@ h8300_option_override (void)
370370 h8_pop_op = h8_pop_ops[cpu_type];
371371 h8_mov_op = h8_mov_ops[cpu_type];
372372
373+ if (TARGET_H8300H && (TARGET_H8300S || TARGET_H8300SX))
374+ {
375+ target_flags ^= MASK_H8300H;
376+ }
377+
373378 if (!TARGET_H8300S && TARGET_MAC)
374379 {
375380 error ("-ms2600 is used without -ms");
@@ -1006,12 +1011,12 @@ h8300_file_start (void)
10061011 {
10071012 default_file_start ();
10081013
1009- if (TARGET_H8300H)
1010- fputs (TARGET_NORMAL_MODE ? "\t.h8300hn\n" : "\t.h8300h\n", asm_out_file);
1011- else if (TARGET_H8300SX)
1014+ if (TARGET_H8300SX)
10121015 fputs (TARGET_NORMAL_MODE ? "\t.h8300sxn\n" : "\t.h8300sx\n", asm_out_file);
10131016 else if (TARGET_H8300S)
10141017 fputs (TARGET_NORMAL_MODE ? "\t.h8300sn\n" : "\t.h8300s\n", asm_out_file);
1018+ else if (TARGET_H8300H)
1019+ fputs (TARGET_NORMAL_MODE ? "\t.h8300hn\n" : "\t.h8300h\n", asm_out_file);
10151020 }
10161021
10171022 /* Output assembly language code for the end of file. */
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -1001,7 +1001,7 @@
10011001 (clobber (scratch:QI))])]
10021002 ""
10031003 [(set_attr "length" "2,8,10")
1004- (set_attr "cc" "set_zn,set_zn,set_zn")])
1004+ (set_attr "cc" "set_zn,set_zn,set_zn")])
10051005
10061006 (define_insn "*tstqi"
10071007 [(set (cc0)
@@ -1762,7 +1762,11 @@
17621762 (and:QI (match_operand:QI 1 "register_operand" "")
17631763 (match_operand:QI 2 "h8300_src_operand" "")))]
17641764 ""
1765- "")
1765+ "if (!TARGET_H8300SX)
1766+{
1767+ if (fix_bit_operand (operands, AND))
1768+ DONE ;
1769+}")
17661770
17671771 (define_expand "andhi3"
17681772 [(set (match_operand:HI 0 "register_operand" "")
@@ -1892,7 +1896,11 @@
18921896 (ior:QI (match_operand:QI 1 "register_operand" "")
18931897 (match_operand:QI 2 "h8300_src_operand" "")))]
18941898 ""
1895- "")
1899+ "if (TARGET_H8300SX)
1900+{
1901+ if (fix_bit_operand (operands, IOR))
1902+ DONE;
1903+}")
18961904
18971905 (define_expand "iorhi3"
18981906 [(set (match_operand:HI 0 "register_operand" "")
@@ -1969,7 +1977,11 @@
19691977 (xor:QI (match_operand:QI 1 "register_operand" "")
19701978 (match_operand:QI 2 "h8300_src_operand" "")))]
19711979 ""
1972- "")
1980+ "if (TARGET_H8300SX)
1981+{
1982+ if (fix_bit_operand (operands, IOR))
1983+ DONE;
1984+}")
19731985
19741986 (define_expand "xorhi3"
19751987 [(set (match_operand:HI 0 "register_operand" "")
--- /dev/null
+++ b/gcc/config/h8300/linux.h
@@ -0,0 +1,47 @@
1+/* Definitions of target machine for GNU compiler.
2+ Renesas H8/300 (linux variant)
3+ Copyright (C) 2015
4+ Free Software Foundation, Inc.
5+ Contributed by Yoshinori Sato <ysato@users.sourceforge.jp>
6+
7+This file is part of GCC.
8+
9+GCC is free software; you can redistribute it and/or modify
10+it under the terms of the GNU General Public License as published by
11+the Free Software Foundation; either version 3, or (at your option)
12+any later version.
13+
14+GCC is distributed in the hope that it will be useful,
15+but WITHOUT ANY WARRANTY; without even the implied warranty of
16+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+GNU General Public License for more details.
18+
19+You should have received a copy of the GNU General Public License
20+along with GCC; see the file COPYING3. If not see
21+<http://www.gnu.org/licenses/>. */
22+
23+#ifndef GCC_H8300_LINUX_H
24+#define GCC_H8300_LINUX_H
25+
26+#define TARGET_OS_CPP_BUILTINS() \
27+ do \
28+ { \
29+ GNU_USER_TARGET_OS_CPP_BUILTINS(); \
30+ } \
31+ while (0)
32+
33+#undef LINK_SPEC
34+#define LINK_SPEC "%{mh:%{!mn:-m h8300helf_linux}} %{ms:%{!mn:-m h8300self_linux}}"
35+
36+#undef TARGET_DEFAULT
37+#define TARGET_DEFAULT (MASK_QUICKCALL | MASK_INT32 | MASK_H8300H)
38+
39+/* Width of a word, in units (bytes). */
40+#undef DOUBLE_TYPE_SIZE
41+#define DOUBLE_TYPE_SIZE 64
42+
43+#undef DEFAULT_SIGNED_CHAR
44+#define DEFAULT_SIGNED_CHAR 1
45+
46+#undef USER_LABEL_PREFIX
47+#endif /* ! GCC_H8300_LINUX_H */
--- /dev/null
+++ b/gcc/config/h8300/t-linux
@@ -0,0 +1,20 @@
1+# Copyright (C) 2015 Free Software Foundation, Inc.
2+#
3+# This file is part of GCC.
4+#
5+# GCC is free software; you can redistribute it and/or modify
6+# it under the terms of the GNU General Public License as published by
7+# the Free Software Foundation; either version 3, or (at your option)
8+# any later version.
9+#
10+# GCC is distributed in the hope that it will be useful,
11+# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+# GNU General Public License for more details.
14+#
15+# You should have received a copy of the GNU General Public License
16+# along with GCC; see the file COPYING3. If not see
17+# <http://www.gnu.org/licenses/>.
18+
19+MULTILIB_OPTIONS = ms/msx
20+MULTILIB_DIRNAMES = h8300s h8sx
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -487,6 +487,10 @@ h8300-*-elf*)
487487 tm_file="$tm_file h8300/h8300-lib.h"
488488 extra_parts="$extra_parts crti.o crtn.o"
489489 ;;
490+h8300-*-linux*)
491+ tmake_file="t-linux h8300/t-linux t-softfp-sfdf t-softfp"
492+ tm_file="$tm_file h8300/h8300-lib.h"
493+ ;;
490494 hppa*64*-*-linux*)
491495 tmake_file="$tmake_file pa/t-linux pa/t-linux64"
492496 extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
--- a/libgcc/config/h8300/lib1funcs.S
+++ b/libgcc/config/h8300/lib1funcs.S
@@ -84,6 +84,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
8484 #define A3E e3
8585 #endif
8686
87+#define CONCAT(A,B) A##B
88+#define LABEL0(U,X) CONCAT(U,__##X)
89+#define LABEL0_DEF(U,X) CONCAT(U,__##X##:)
90+#define LABEL_DEF(X) LABEL0_DEF(__USER_LABEL_PREFIX__,X)
91+#define LABEL(X) LABEL0(__USER_LABEL_PREFIX__,X)
92+
8793 #ifdef __H8300H__
8894 #ifdef __NORMAL_MODE__
8995 .h8300hn
@@ -111,8 +117,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
111117 #ifdef __H8300__
112118 .section .text
113119 .align 2
114- .global ___cmpsi2
115-___cmpsi2:
120+ .global LABEL(cmpsi2)
121+LABEL_DEF(cmpsi2)
116122 cmp.w A0,A2
117123 bne .L2
118124 cmp.w A1,A3
@@ -137,8 +143,8 @@ ___cmpsi2:
137143 #ifdef __H8300__
138144 .section .text
139145 .align 2
140- .global ___ucmpsi2
141-___ucmpsi2:
146+ .global LABEL(ucmpsi2)
147+LABEL_DEF(ucmpsi2)
142148 cmp.w A0,A2
143149 bne .L2
144150 cmp.w A1,A3
@@ -207,10 +213,10 @@ _lab8: rts
207213
208214 ; A0=A0/A1 signed
209215
210- .global ___divhi3
211-___divhi3:
216+ .global LABEL(divhi3)
217+LABEL_DEF(divhi3)
212218 bsr divnorm
213- bsr ___udivhi3
219+ bsr LABEL(udivhi3)
214220 negans: btst #3,A2L ; should answer be negative ?
215221 beq _lab4
216222 not A0H ; yes, so make it so
@@ -220,18 +226,18 @@ _lab4: rts
220226
221227 ; A0=A0%A1 signed
222228
223- .global ___modhi3
224-___modhi3:
229+ .global LABEL(modhi3)
230+LABEL_DEF(modhi3)
225231 bsr modnorm
226- bsr ___udivhi3
232+ bsr LABEL(udivhi3)
227233 mov A3,A0
228234 bra negans
229235
230236 ; A0=A0%A1 unsigned
231237
232- .global ___umodhi3
233-___umodhi3:
234- bsr ___udivhi3
238+ .global LABEL(umodhi3)
239+LABEL_DEF(umodhi3)
240+ bsr LABEL(udivhi3)
235241 mov A3,A0
236242 rts
237243
@@ -251,8 +257,8 @@ ___umodhi3:
251257 ; The H8/300 only has a 16/8 bit divide, so we look at the incoming and
252258 ; see how to partition up the expression.
253259
254- .global ___udivhi3
255-___udivhi3:
260+ .global LABEL(udivhi3)
261+LABEL_DEF(udivhi3)
256262 ; A0 A1 A2 A3
257263 ; Nn Dd P
258264 sub.w A3,A3 ; Nn Dd xP 00
@@ -418,8 +424,8 @@ mpostive2:
418424
419425 ; numerator in A0/A1
420426 ; denominator in A2/A3
421- .global ___modsi3
422-___modsi3:
427+ .global LABEL(modsi3)
428+LABEL_DEF(modsi3)
423429 #ifdef __H8300__
424430 PUSHP S2P
425431 PUSHP S0P
@@ -432,7 +438,7 @@ ___modsi3:
432438 #else
433439 PUSHP S2P
434440 bsr modnorm
435- bsr ___udivsi3
441+ bsr LABEL(divsi3)
436442 mov.l er3,er0
437443 bra exitdiv
438444 #endif
@@ -440,8 +446,8 @@ ___modsi3:
440446 ;; H8/300H and H8S version of ___udivsi3 is defined later in
441447 ;; the file.
442448 #ifdef __H8300__
443- .global ___udivsi3
444-___udivsi3:
449+ .global LABEL(udivsi3)
450+LABEL_DEF(udivsi3)
445451 PUSHP S2P
446452 PUSHP S0P
447453 PUSHP S1P
@@ -449,8 +455,8 @@ ___udivsi3:
449455 bra reti
450456 #endif
451457
452- .global ___umodsi3
453-___umodsi3:
458+ .global LABEL(umodsi3)
459+LABEL_DEF(umodsi3)
454460 #ifdef __H8300__
455461 PUSHP S2P
456462 PUSHP S0P
@@ -460,13 +466,13 @@ ___umodsi3:
460466 mov S1,A1
461467 bra reti
462468 #else
463- bsr ___udivsi3
469+ bsr LABEL(udivsi3)
464470 mov.l er3,er0
465471 rts
466472 #endif
467473
468- .global ___divsi3
469-___divsi3:
474+ .global LABEL(divsi3)
475+LABEL_DEF(divsi3)
470476 #ifdef __H8300__
471477 PUSHP S2P
472478 PUSHP S0P
@@ -476,7 +482,7 @@ ___divsi3:
476482 #else
477483 PUSHP S2P
478484 jsr divnorm
479- bsr ___udivsi3
485+ bsr LABEL(udivsi3)
480486 #endif
481487
482488 ; examine what the sign should be
@@ -591,8 +597,8 @@ setone:
591597 #else /* __H8300H__ */
592598
593599 ;; This function also computes the remainder and stores it in er3.
594- .global ___udivsi3
595-___udivsi3:
600+ .global LABEL(udivsi3)
601+LABEL_DEF(udivsi3)
596602 mov.w A1E,A1E ; denominator top word 0?
597603 bne DenHighNonZero
598604
@@ -681,8 +687,8 @@ divmod_L26:
681687 #ifdef __H8300__
682688 .section .text
683689 .align 2
684- .global ___mulhi3
685-___mulhi3:
690+ .global LABEL(mulhi3)
691+LABEL_DEF(mulhi3)
686692 mov.b A1L,A2L ; A2l gets srcb.l
687693 mulxu A0L,A2 ; A2 gets first sub product
688694
@@ -726,8 +732,8 @@ ___mulhi3:
726732
727733 #ifdef __H8300__
728734
729- .global ___mulsi3
730-___mulsi3:
735+ .global LABEL(mulsi3)
736+LABEL_DEF(mulsi3)
731737 PUSHP S0P
732738 PUSHP S1P
733739
@@ -785,8 +791,8 @@ _done:
785791 ; 32b * 32b = 92 states
786792 ;
787793
788- .global ___mulsi3
789-___mulsi3:
794+ .global LABEL(mulsi3)
795+LABEL_DEF(mulsi3)
790796 mov.w r1,r2 ; ( 2 states) b * d
791797 mulxu r0,er2 ; (22 states)
792798
@@ -814,11 +820,11 @@ L_skip2:
814820 #ifdef __H8300__
815821 /* We still treat NANs different than libgcc2.c, but then, the
816822 behavior is undefined anyways. */
817- .global ___fixunssfsi
818-___fixunssfsi:
823+ .global LABEL(fixunssfsi)
824+LABEL_DEF(fixunssfsi)
819825 cmp.b #0x4f,r0h
820826 bge Large_num
821- jmp @___fixsfsi
827+ jmp @LABEL(fixsfsi)
822828 Large_num:
823829 bhi L_huge_num
824830 xor.b #0x80,A0L
--- /dev/null
+++ b/libgcc/config/h8300/sfp-machine.h
@@ -0,0 +1,76 @@
1+/* Soft-FP definitions for Altera Nios II.
2+ Copyright (C) 2013-2015 Free Software Foundation, Inc.
3+
4+This file is free software; you can redistribute it and/or modify it
5+under the terms of the GNU General Public License as published by the
6+Free Software Foundation; either version 3, or (at your option) any
7+later version.
8+
9+This file is distributed in the hope that it will be useful, but
10+WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+General Public License for more details.
13+
14+Under Section 7 of GPL version 3, you are granted additional
15+permissions described in the GCC Runtime Library Exception, version
16+3.1, as published by the Free Software Foundation.
17+
18+You should have received a copy of the GNU General Public License and
19+a copy of the GCC Runtime Library Exception along with this program;
20+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21+<http://www.gnu.org/licenses/>. */
22+
23+#define _FP_W_TYPE_SIZE 32
24+#define _FP_W_TYPE unsigned long
25+#define _FP_WS_TYPE signed long
26+#define _FP_I_TYPE long
27+
28+#define _FP_MUL_MEAT_S(R,X,Y) \
29+ _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
30+#define _FP_MUL_MEAT_D(R,X,Y) \
31+ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
32+#define _FP_MUL_MEAT_Q(R,X,Y) \
33+ _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
34+
35+#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y)
36+#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
37+#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
38+
39+#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
40+#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
41+#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
42+#define _FP_NANSIGN_S 0
43+#define _FP_NANSIGN_D 0
44+#define _FP_NANSIGN_Q 0
45+
46+#define _FP_KEEPNANFRACP 1
47+#define _FP_QNANNEGATEDP 0
48+
49+/* Someone please check this. */
50+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
51+ do { \
52+ if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
53+ && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
54+ { \
55+ R##_s = Y##_s; \
56+ _FP_FRAC_COPY_##wc(R,Y); \
57+ } \
58+ else \
59+ { \
60+ R##_s = X##_s; \
61+ _FP_FRAC_COPY_##wc(R,X); \
62+ } \
63+ R##_c = FP_CLS_NAN; \
64+ } while (0)
65+
66+/* Not checked. */
67+#define _FP_TININESS_AFTER_ROUNDING 0
68+
69+#define __BIG_ENDIAN 4321
70+
71+#define __BYTE_ORDER __BIG_ENDIAN
72+
73+/* Define ALIASNAME as a strong alias for NAME. */
74+# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
75+# define _strong_alias(name, aliasname) \
76+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
--- /dev/null
+++ b/libgcc/config/h8300/t-linux
@@ -0,0 +1,10 @@
1+LIB1ASMSRC = h8300/lib1funcs.S
2+LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \
3+ _fixunssfsi_asm
4+
5+LIB2ADD += \
6+ $(srcdir)/config/h8300/clzhi2.c \
7+ $(srcdir)/config/h8300/ctzhi2.c \
8+ $(srcdir)/config/h8300/parityhi2.c \
9+ $(srcdir)/config/h8300/popcounthi2.c \
10+ $(srcdir)/config/h8300/fixunssfsi.c