+2012-08-09 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * config/i386/adxintrin.h: Remove guarding __ADX__ check.
+ * config/i386/x86intrin.h: Likewise.
+ * config/i386/i386.c (ix86_init_mmx_sse_builtins): Remove
+ OPTION_MASK_ISA_ADX from needed options for
+ __builtin_ia32_addcarryx_u32 and __builtin_ia32_addcarryx_u64.
+ (ix86_expand_builtin): Use add<mode>3_carry in expanding of
+ IX86_BUILTIN_ADDCARRYX32 and IX86_BUILTIN_ADDCARRYX64.
+
2012-08-09 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/53701
# error "Never use <adxintrin.h> directly; include <x86intrin.h> instead."
#endif
-#ifndef __ADX__
-# error "Flag-preserving add-carry instructions not enabled"
-#endif /* __ADX__ */
-
#ifndef _ADXINTRIN_H_INCLUDED
#define _ADXINTRIN_H_INCLUDED
INT_FTYPE_PULONGLONG, IX86_BUILTIN_RDSEED64_STEP);
/* ADCX */
- def_builtin (OPTION_MASK_ISA_ADX, "__builtin_ia32_addcarryx_u32",
+ def_builtin (0, "__builtin_ia32_addcarryx_u32",
UCHAR_FTYPE_UCHAR_UINT_UINT_PUNSIGNED, IX86_BUILTIN_ADDCARRYX32);
- def_builtin (OPTION_MASK_ISA_ADX && OPTION_MASK_ISA_64BIT,
+ def_builtin (OPTION_MASK_ISA_64BIT,
"__builtin_ia32_addcarryx_u64",
UCHAR_FTYPE_UCHAR_ULONGLONG_ULONGLONG_PULONGLONG,
IX86_BUILTIN_ADDCARRYX64);
return target;
case IX86_BUILTIN_ADDCARRYX32:
- icode = CODE_FOR_adcxsi3;
+ icode = TARGET_ADX ? CODE_FOR_adcxsi3 : CODE_FOR_addsi3_carry;
mode0 = SImode;
goto addcarryx;
case IX86_BUILTIN_ADDCARRYX64:
- icode = CODE_FOR_adcxdi3;
+ icode = TARGET_ADX ? CODE_FOR_adcxdi3 : CODE_FOR_adddi3_carry;
mode0 = DImode;
addcarryx:
#include <prfchwintrin.h>
#endif
-#ifdef __ADX__
#include <adxintrin.h>
-#endif
#endif /* _X86INTRIN_H_INCLUDED */
+2012-08-09 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * gcc.target/i386/adx-addxcarry32-3.c: New.
+ * gcc.target/i386/adx-addxcarry64-3.c: New.
+
2012-08-09 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/53701
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mno-adx -O2" } */
+/* { dg-final { scan-assembler "adcl" } } */
+
+#include <x86intrin.h>
+
+volatile unsigned char c;
+volatile unsigned int x, y;
+unsigned int *sum;
+
+void extern
+adx_test (void)
+{
+ c = _addcarryx_u32 (c, x, y, sum);
+}
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mno-adx -O2" } */
+/* { dg-final { scan-assembler "adcq" } } */
+
+#include <x86intrin.h>
+
+volatile unsigned char c;
+volatile unsigned long long x, y;
+unsigned long long *sum;
+
+void extern
+adx_test (void)
+{
+ c = _addcarryx_u64 (c, x, y, sum);
+}