ports/172352: Add __even_in_range() stub to devel/msp430-gcc
Kevin Lo
kevlo at FreeBSD.org
Fri Oct 5 09:20:05 UTC 2012
>Number: 172352
>Category: ports
>Synopsis: Add __even_in_range() stub to devel/msp430-gcc
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Fri Oct 05 09:20:04 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Kevin Lo
>Release: 10-current
>Organization:
>Environment:
FreeBSD 10.0-CURRENT
>Description:
Add __even_in_range() stub from upstream.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
diff -ruN msp430-gcc.orig/Makefile msp430-gcc/Makefile
--- msp430-gcc.orig/Makefile 2012-09-26 11:21:19.000000000 +0800
+++ msp430-gcc/Makefile 2012-09-26 12:38:07.000000000 +0800
@@ -7,7 +7,7 @@
PORTNAME= gcc
PORTVERSION= ${GCCVERSION}.${LTSVERSION}
-PORTREVISION= 0
+PORTREVISION= 1
PORTEPOCH= 2
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_SOURCEWARE} \
@@ -25,7 +25,7 @@
PATCH_DIST_STRIP= -p1
MAINTAINER= lev at FreeBSD.org
-COMMENT= FSF gcc-4.5 for TI's msp430 MCUs cross-development
+COMMENT= FSF GCC 4.x for TI's msp430 MCUs cross-development
LICENSE= GPLv3
@@ -88,6 +88,8 @@
pre-patch:
@cd ${SRCDIR} && ${PATCH} -s -p1 < ../mspgcc-${LTSVERSION}/${PKGNAMEPREFIX}${PORTNAME}-${GCCVERSION}-${PATCHVERSION}.patch
+ ${CP} ${SRCDIR}/gcc/config/msp430/msp430-builtins.c \
+ ${SRCDIR}/gcc/config/msp430/msp430-builtins.c.orig
pre-configure:
cd ${SRCDIR} ; contrib/gcc_update --touch
diff -ruN msp430-gcc.orig/files/patch-gcc-config-msp430-msp430-builtins.c msp430-gcc/files/patch-gcc-config-msp430-msp430-builtins.c
--- msp430-gcc.orig/files/patch-gcc-config-msp430-msp430-builtins.c 1970-01-01 08:00:00.000000000 +0800
+++ msp430-gcc/files/patch-gcc-config-msp430-msp430-builtins.c 2012-09-26 12:49:32.000000000 +0800
@@ -0,0 +1,55 @@
+--- gcc/config/msp430/msp430-builtins.c.orig 2012-09-26 12:24:42.000000000 +0800
++++ gcc/config/msp430/msp430-builtins.c 2012-09-26 12:28:31.000000000 +0800
+@@ -59,6 +59,7 @@
+ MSP430_BUILTIN_GET_WATCHDOG_CLEAR_VALUE,
+ MSP430_BUILTIN_SET_WATCHDOG_CLEAR_VALUE,
+ MSP430_BUILTIN_WATCHDOG_CLEAR,
++ MSP430_BUILTIN_EVEN_IN_RANGE,
+ MSP430_BUILTIN_last_enum
+ };
+
+@@ -153,6 +154,13 @@
+ add_builtin_function ("__watchdog_clear",
+ build_function_type_list (void_type_node, NULL_TREE),
+ MSP430_BUILTIN_WATCHDOG_CLEAR, BUILT_IN_MD, NULL, NULL_TREE);
++ add_builtin_function ("__even_in_range",
++ build_function_type_list (unsigned_type_node,
++ unsigned_type_node,
++ unsigned_type_node,
++ NULL_TREE),
++ MSP430_BUILTIN_EVEN_IN_RANGE, BUILT_IN_MD,
++ NULL, NULL_TREE);
+ }
+
+ rtx
+@@ -432,6 +440,30 @@
+ emit_move_insn (retval, arg);
+ insn = gen_bswaphi1 (retval);
+ break;
++ case MSP430_BUILTIN_EVEN_IN_RANGE:
++ {
++ tree key_tree = CALL_EXPR_ARG (exp, 0);
++ tree limit_tree = CALL_EXPR_ARG (exp, 1);
++ rtx key;
++ HOST_WIDE_INT limit_val;
++
++ need_insn = false;
++ if (!cst_and_fits_in_hwi (limit_tree)
++ || (0 > ((limit_val = int_cst_value (limit_tree)))))
++ {
++ error
++ ("__even_in_range second argument must be non-negative integer constant");
++ break;
++ }
++ key = expand_expr (key_tree, NULL_RTX, VOIDmode, EXPAND_NORMAL);
++ retval = gen_reg_rtx (HImode);
++ /* This is a stub. To complete this, we need to attach notes
++ * that assert that the value is, in fact, even and between 0
++ * and the second argument. No idea how to do that in a way
++ * that gcc's tablejump will pay any attention to. */
++ emit_move_insn (retval, key);
++ break;
++ }
+ }
+
+ if (insn)
diff -ruN msp430-gcc.orig/pkg-descr msp430-gcc/pkg-descr
--- msp430-gcc.orig/pkg-descr 2012-09-26 11:21:19.000000000 +0800
+++ msp430-gcc/pkg-descr 2012-09-26 12:38:51.000000000 +0800
@@ -1,4 +1,4 @@
-FSF gcc-4.5 for TI's msp430 MCUs cross-development
+FSF gcc-4.x for TI's msp430 MCUs cross-development
This brings the gcc compiler for the Texas Instruments MSP430 16-bit
RISC-like family of microcontrollers.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list