From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12033 invoked by alias); 8 May 2010 06:22:35 -0000 Received: (qmail 11981 invoked by uid 48); 8 May 2010 06:22:14 -0000 Date: Sat, 08 May 2010 06:22:00 -0000 Subject: [Bug c/44037] New: builtin ffs vs. renamed ffs (vms-crtl.h)‏ X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jay dot krell at cornell dot edu" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg00776.txt.bz2 In gcc for VMS there is some mechanism to rename functions. See the files: /src/gcc-4.5.0/gcc/config/vms/vms-crtl-64.h /src/gcc-4.5.0/gcc/config/vms/vms-crtl.h which are mostly just lists of function from/to. As well in gcc there is a mechanism for optimizing various "builtin" functions, like ffs. These two mechanisms seem to conflict or be applied in the wrong order. I didn't look at it deeply. The symptom is that if you add ffs (to decc$ffs) to vms-crtl.h, the translation is not done, and you end up with unresolved external ffs. If you #if out the support for "builtin ffs", it works. My local hack is below but obviously that's not the way. I'll enter a bug. Thanks, - Jay diff -u /src/orig/gcc-4.5.0/gcc/builtins.c ./builtins.c --- /src/orig/gcc-4.5.0/gcc/builtins.c 2010-04-13 06:47:11.000000000 -0700 +++ ./builtins.c 2010-05-07 23:11:30.000000000 -0700 @@ -51,6 +51,8 @@ #include "value-prof.h" #include "diagnostic.h" +#define DISABLE_FFS + #ifndef SLOW_UNALIGNED_ACCESS #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT #endif @@ -5899,6 +5901,7 @@ return target; break; +#ifndef DISABLE_FFS CASE_INT_FN (BUILT_IN_FFS): case BUILT_IN_FFSIMAX: target = expand_builtin_unop (target_mode, exp, target, @@ -5906,6 +5909,7 @@ if (target) return target; break; +#endif CASE_INT_FN (BUILT_IN_CLZ): case BUILT_IN_CLZIMAX: @@ -13612,6 +13616,7 @@ case BUILT_IN_ABORT: abort_libfunc = set_user_assembler_libfunc ("abort", asmspec); break; +#ifndef DISABLE_FFS case BUILT_IN_FFS: if (INT_TYPE_SIZE < BITS_PER_WORD) { @@ -13620,6 +13625,7 @@ MODE_INT, 0), "ffs"); } break; +#endif default: break; } diff -u /src/orig/gcc-4.5.0/gcc/optabs.c ./optabs.c --- /src/orig/gcc-4.5.0/gcc/optabs.c 2010-03-19 12:45:01.000000000 -0700 +++ ./optabs.c 2010-05-07 23:11:36.000000000 -0700 @@ -45,6 +45,8 @@ #include "basic-block.h" #include "target.h" +#define DISABLE_FFS + /* Each optab contains info on how this target machine can perform a particular operation for all sizes and kinds of operands. @@ -3240,6 +3242,7 @@ return temp; } +#ifndef DISABLE_FFS /* Try implementing ffs (x) in terms of clz (x). */ if (unoptab == ffs_optab) { @@ -3247,6 +3250,7 @@ if (temp) return temp; } +#endif /* Try implementing ctz (x) in terms of clz (x). */ if (unoptab == ctz_optab) @@ -3268,7 +3272,11 @@ /* All of these functions return small values. Thus we choose to have them return something that isn't a double-word. */ - if (unoptab == ffs_optab || unoptab == clz_optab || unoptab == ctz_optab + if ( +#ifndef DISABLE_FFS + unoptab == ffs_optab || +#endif + unoptab == clz_optab || unoptab == ctz_optab || unoptab == popcount_optab || unoptab == parity_optab) outmode = GET_MODE (hard_libcall_value (TYPE_MODE (integer_type_node), @@ -6301,7 +6309,9 @@ init_optab (addcc_optab, UNKNOWN); init_optab (one_cmpl_optab, NOT); init_optab (bswap_optab, BSWAP); +#ifndef DISABLE_FFS init_optab (ffs_optab, FFS); +#endif init_optab (clz_optab, CLZ); init_optab (ctz_optab, CTZ); init_optab (popcount_optab, POPCOUNT); @@ -6558,9 +6568,11 @@ one_cmpl_optab->libcall_basename = "one_cmpl"; one_cmpl_optab->libcall_suffix = '2'; one_cmpl_optab->libcall_gen = gen_int_libfunc; +#ifndef DISABLE_FFS ffs_optab->libcall_basename = "ffs"; ffs_optab->libcall_suffix = '2'; ffs_optab->libcall_gen = gen_int_libfunc; +#endif clz_optab->libcall_basename = "clz"; clz_optab->libcall_suffix = '2'; clz_optab->libcall_gen = gen_int_libfunc; @@ -6643,11 +6655,13 @@ satfractuns_optab->libcall_basename = "satfractuns"; satfractuns_optab->libcall_gen = gen_satfractuns_conv_libfunc; +#ifndef DISABLE_FFS /* The ffs function operates on `int'. Fall back on it if we do not have a libgcc2 function for that width. */ if (INT_TYPE_SIZE < BITS_PER_WORD) set_optab_libfunc (ffs_optab, mode_for_size (INT_TYPE_SIZE, MODE_INT, 0), "ffs"); +#endif /* Explicitly initialize the bswap libfuncs since we need them to be valid for things other than word_mode. */ Thanks, - Jay -- Summary: builtin ffs vs. renamed ffs (vms-crtl.h)‏ Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jay dot krell at cornell dot edu GCC target triplet: alpha-dec-vms http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44037