diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-12-14 17:45:11 +0100 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-12-14 16:45:11 +0000 |
commit | 519517fd497032bb67c1231a31c6422c3b17b928 (patch) | |
tree | 61d0e6114c05f06f2f2405ea6968aec76e33d5ae /gcc/config/i386 | |
parent | e49fd61b531da9ab5e8b9ad35e134769473c533f (diff) | |
download | gcc-519517fd497032bb67c1231a31c6422c3b17b928.zip gcc-519517fd497032bb67c1231a31c6422c3b17b928.tar.gz gcc-519517fd497032bb67c1231a31c6422c3b17b928.tar.bz2 |
Fix LWP.
2009-12-14 Jakub Jelinek <jakub@redhat.com>
Sebastian Pop <sebastian.pop@amd.com>
* config/i386/i386-builtin-types.def (PVOID): Declared.
(VOID_FTYPE_PVOID): Declared.
(PVOID_FTYPE_VOID): Declared.
(UCHAR_FTYPE_USHORT_UINT_USHORT): Removed.
(VOID_FTYPE_USHORT_UINT_USHORT): Removed.
* config/i386/i386.c (IX86_BUILTIN_LLWPCB16, IX86_BUILTIN_LLWPCB32,
IX86_BUILTIN_LLWPCB64, IX86_BUILTIN_SLWPCB16, IX86_BUILTIN_SLWPCB32,
IX86_BUILTIN_SLWPCB64, IX86_BUILTIN_LWPVAL16, IX86_BUILTIN_LWPINS16):
Removed.
(IX86_BUILTIN_LLWPCB, IX86_BUILTIN_SLWPCB): New.
(bdesc_special_args): Adjust declaration of __builtin_ia32_llwpcb,
__builtin_ia32_slwpcb, __builtin_ia32_lwpval32,
__builtin_ia32_lwpval64, __builtin_ia32_lwpins32, and
__builtin_ia32_lwpins64.
(ix86_expand_special_args_builtin): Handle VOID_FTYPE_PVOID.
Do not handle VOID_FTYPE_USHORT_UINT_USHORT and
UCHAR_FTYPE_USHORT_UINT_USHORT. Warn when the third operand is
not an immediate. Also handle builtin functions with 3 arguments.
(ix86_expand_builtin): Handle IX86_BUILTIN_LLWPCB and
IX86_BUILTIN_SLWPCB.
* config/i386/i386.md (UNSPEC_LLWP_INTRINSIC, UNSPEC_SLWP_INTRINSIC):
Renamed UNSPECV_LLWP_INTRINSIC and UNSPECV_SLWP_INTRINSIC.
(memory attribute): Handle lwp.
(lwp*): Rewrite all the insn patterns for LWP.
* config/i386/lwpintrin.h (__llwpcb16, __llwpcb32, __llwpcb64,
__slwpcb16, __slwpcb32, __slwpcb64, __lwpval16, __lwpins16): Removed.
(__llwpcb, __slwpcb): New.
testsuite/
* gcc.target/i386/sse-12.c: Add -mpopcnt and -mlwp.
* gcc.target/i386/sse-13.c: Same.
(__builtin_ia32_lwpval32, __builtin_ia32_lwpval64,
__builtin_ia32_lwpins32, __builtin_ia32_lwpins64): Added testcases.
* gcc.target/i386/sse-14.c: Add -mpopcnt -mabm -mlwp.
Added tests for __lwpval32, __lwpins32, __lwpval64, and __lwpins64.
* gcc.target/i386/sse-22.c: Added tests for popcnt, abm, and lwp.
* gcc.target/i386/sse-23.c: Same.
Co-Authored-By: Sebastian Pop <sebastian.pop@amd.com>
From-SVN: r155217
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/i386-builtin-types.def | 5 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 69 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 151 | ||||
-rw-r--r-- | gcc/config/i386/lwpintrin.h | 75 |
4 files changed, 139 insertions, 161 deletions
diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def index e9e4d0c4..1fad60f 100644 --- a/gcc/config/i386/i386-builtin-types.def +++ b/gcc/config/i386/i386-builtin-types.def @@ -104,6 +104,7 @@ DEF_POINTER_TYPE (PCDOUBLE, DOUBLE, CONST) DEF_POINTER_TYPE (PCFLOAT, FLOAT, CONST) DEF_POINTER_TYPE (PCHAR, CHAR) DEF_POINTER_TYPE (PCVOID, VOID, CONST) +DEF_POINTER_TYPE (PVOID, VOID) DEF_POINTER_TYPE (PDOUBLE, DOUBLE) DEF_POINTER_TYPE (PFLOAT, FLOAT) DEF_POINTER_TYPE (PINT, INT) @@ -195,6 +196,8 @@ DEF_FUNCTION_TYPE (V8SF, V8SI) DEF_FUNCTION_TYPE (V8SI, V4SI) DEF_FUNCTION_TYPE (V8SI, V8SF) DEF_FUNCTION_TYPE (VOID, PCVOID) +DEF_FUNCTION_TYPE (VOID, PVOID) +DEF_FUNCTION_TYPE (PVOID, VOID) DEF_FUNCTION_TYPE (VOID, UNSIGNED) DEF_FUNCTION_TYPE (DI, V2DI, INT) @@ -301,7 +304,6 @@ DEF_FUNCTION_TYPE (VOID, UNSIGNED, UNSIGNED) DEF_FUNCTION_TYPE (INT, V16QI, V16QI, INT) DEF_FUNCTION_TYPE (UCHAR, UINT, UINT, UINT) DEF_FUNCTION_TYPE (UCHAR, UINT64, UINT, UINT) -DEF_FUNCTION_TYPE (UCHAR, USHORT, UINT, USHORT) DEF_FUNCTION_TYPE (V16HI, V16HI, V16HI, V16HI) DEF_FUNCTION_TYPE (V16QI, V16QI, QI, INT) DEF_FUNCTION_TYPE (V16QI, V16QI, V16QI, INT) @@ -343,7 +345,6 @@ DEF_FUNCTION_TYPE (VOID, PV4SF, V4SF, V4SF) DEF_FUNCTION_TYPE (VOID, PV8SF, V8SF, V8SF) DEF_FUNCTION_TYPE (VOID, UINT, UINT, UINT) DEF_FUNCTION_TYPE (VOID, UINT64, UINT, UINT) -DEF_FUNCTION_TYPE (VOID, USHORT, UINT, USHORT) DEF_FUNCTION_TYPE (VOID, V16QI, V16QI, PCHAR) DEF_FUNCTION_TYPE (VOID, V8QI, V8QI, PCHAR) DEF_FUNCTION_TYPE (V2DF, V2DF, V2DF, V2DI) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 0e58a17..9b739a6 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -21251,16 +21251,10 @@ enum ix86_builtins IX86_BUILTIN_VPCOMTRUEQ, /* LWP instructions. */ - IX86_BUILTIN_LLWPCB16, - IX86_BUILTIN_LLWPCB32, - IX86_BUILTIN_LLWPCB64, - IX86_BUILTIN_SLWPCB16, - IX86_BUILTIN_SLWPCB32, - IX86_BUILTIN_SLWPCB64, - IX86_BUILTIN_LWPVAL16, + IX86_BUILTIN_LLWPCB, + IX86_BUILTIN_SLWPCB, IX86_BUILTIN_LWPVAL32, IX86_BUILTIN_LWPVAL64, - IX86_BUILTIN_LWPINS16, IX86_BUILTIN_LWPINS32, IX86_BUILTIN_LWPINS64, @@ -21532,20 +21526,12 @@ static const struct builtin_description bdesc_special_args[] = { OPTION_MASK_ISA_AVX, CODE_FOR_avx_maskstorepd256, "__builtin_ia32_maskstorepd256", IX86_BUILTIN_MASKSTOREPD256, UNKNOWN, (int) VOID_FTYPE_PV4DF_V4DF_V4DF }, { OPTION_MASK_ISA_AVX, CODE_FOR_avx_maskstoreps256, "__builtin_ia32_maskstoreps256", IX86_BUILTIN_MASKSTOREPS256, UNKNOWN, (int) VOID_FTYPE_PV8SF_V8SF_V8SF }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_llwpcbhi1, "__builtin_ia32_llwpcb16", IX86_BUILTIN_LLWPCB16, UNKNOWN, (int) VOID_FTYPE_VOID }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_llwpcbsi1, "__builtin_ia32_llwpcb32", IX86_BUILTIN_LLWPCB32, UNKNOWN, (int) VOID_FTYPE_VOID }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_llwpcbdi1, "__builtin_ia32_llwpcb64", IX86_BUILTIN_LLWPCB64, UNKNOWN, (int) VOID_FTYPE_VOID }, - - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_slwpcbhi1, "__builtin_ia32_slwpcb16", IX86_BUILTIN_SLWPCB16, UNKNOWN, (int) VOID_FTYPE_VOID }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_slwpcbsi1, "__builtin_ia32_slwpcb32", IX86_BUILTIN_SLWPCB32, UNKNOWN, (int) VOID_FTYPE_VOID }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_slwpcbdi1, "__builtin_ia32_slwpcb64", IX86_BUILTIN_SLWPCB64, UNKNOWN, (int) VOID_FTYPE_VOID }, - - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpvalhi3, "__builtin_ia32_lwpval16", IX86_BUILTIN_LWPVAL16, UNKNOWN, (int) VOID_FTYPE_USHORT_UINT_USHORT }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpvalsi3, "__builtin_ia32_lwpval32", IX86_BUILTIN_LWPVAL64, UNKNOWN, (int) VOID_FTYPE_UINT_UINT_UINT }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpvaldi3, "__builtin_ia32_lwpval64", IX86_BUILTIN_LWPVAL64, UNKNOWN, (int) VOID_FTYPE_UINT64_UINT_UINT }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinshi3, "__builtin_ia32_lwpins16", IX86_BUILTIN_LWPINS16, UNKNOWN, (int) UCHAR_FTYPE_USHORT_UINT_USHORT }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinssi3, "__builtin_ia32_lwpins32", IX86_BUILTIN_LWPINS64, UNKNOWN, (int) UCHAR_FTYPE_UINT_UINT_UINT }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinsdi3, "__builtin_ia32_lwpins64", IX86_BUILTIN_LWPINS64, UNKNOWN, (int) UCHAR_FTYPE_UINT64_UINT_UINT }, + { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_llwpcb, "__builtin_ia32_llwpcb", IX86_BUILTIN_LLWPCB, UNKNOWN, (int) VOID_FTYPE_PVOID }, + { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_slwpcb, "__builtin_ia32_slwpcb", IX86_BUILTIN_SLWPCB, UNKNOWN, (int) PVOID_FTYPE_VOID }, + { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpvalsi3, "__builtin_ia32_lwpval32", IX86_BUILTIN_LWPVAL32, UNKNOWN, (int) VOID_FTYPE_UINT_UINT_UINT }, + { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpvaldi3, "__builtin_ia32_lwpval64", IX86_BUILTIN_LWPVAL64, UNKNOWN, (int) VOID_FTYPE_UINT64_UINT_UINT }, + { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinssi3, "__builtin_ia32_lwpins32", IX86_BUILTIN_LWPINS32, UNKNOWN, (int) UCHAR_FTYPE_UINT_UINT_UINT }, + { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinsdi3, "__builtin_ia32_lwpins64", IX86_BUILTIN_LWPINS64, UNKNOWN, (int) UCHAR_FTYPE_UINT64_UINT_UINT }, }; @@ -23734,7 +23720,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d, { rtx op; enum machine_mode mode; - } args[2]; + } args[3]; enum insn_code icode = d->icode; bool last_arg_constant = false; const struct insn_data *insn_p = &insn_data[icode]; @@ -23761,6 +23747,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d, case V4DF_FTYPE_PCV2DF: case V4DF_FTYPE_PCDOUBLE: case V2DF_FTYPE_PCDOUBLE: + case VOID_FTYPE_PVOID: nargs = 1; klass = load; memory = 0; @@ -23804,15 +23791,14 @@ ix86_expand_special_args_builtin (const struct builtin_description *d, /* Reserve memory operand for target. */ memory = ARRAY_SIZE (args); break; - case VOID_FTYPE_USHORT_UINT_USHORT: case VOID_FTYPE_UINT_UINT_UINT: case VOID_FTYPE_UINT64_UINT_UINT: - case UCHAR_FTYPE_USHORT_UINT_USHORT: case UCHAR_FTYPE_UINT_UINT_UINT: case UCHAR_FTYPE_UINT64_UINT_UINT: nargs = 3; - klass = store; - memory = 0; + klass = load; + memory = ARRAY_SIZE (args); + last_arg_constant = true; break; default: gcc_unreachable (); @@ -23852,7 +23838,14 @@ ix86_expand_special_args_builtin (const struct builtin_description *d, if (!match) switch (icode) { - default: + case CODE_FOR_lwp_lwpvalsi3: + case CODE_FOR_lwp_lwpvaldi3: + case CODE_FOR_lwp_lwpinssi3: + case CODE_FOR_lwp_lwpinsdi3: + error ("the last argument must be a 32-bit immediate"); + return const0_rtx; + + default: error ("the last argument must be an 8-bit immediate"); return const0_rtx; } @@ -23893,6 +23886,9 @@ ix86_expand_special_args_builtin (const struct builtin_description *d, case 2: pat = GEN_FCN (icode) (target, args[0].op, args[1].op); break; + case 3: + pat = GEN_FCN (icode) (target, args[0].op, args[1].op, args[2].op); + break; default: gcc_unreachable (); } @@ -24205,6 +24201,23 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, return target; } + case IX86_BUILTIN_LLWPCB: + arg0 = CALL_EXPR_ARG (exp, 0); + op0 = expand_normal (arg0); + icode = CODE_FOR_lwp_llwpcb; + if (! (*insn_data[icode].operand[0].predicate) (op0, Pmode)) + op0 = copy_to_mode_reg (Pmode, op0); + emit_insn (gen_lwp_llwpcb (op0)); + return 0; + + case IX86_BUILTIN_SLWPCB: + icode = CODE_FOR_lwp_slwpcb; + if (!target + || ! (*insn_data[icode].operand[0].predicate) (target, Pmode)) + target = gen_reg_rtx (Pmode); + emit_insn (gen_lwp_slwpcb (target)); + return target; + default: break; } diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a4e688a..22e6049 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -204,10 +204,6 @@ (UNSPEC_XOP_TRUEFALSE 152) (UNSPEC_XOP_PERMUTE 153) (UNSPEC_FRCZ 154) - (UNSPEC_LLWP_INTRINSIC 155) - (UNSPEC_SLWP_INTRINSIC 156) - (UNSPECV_LWPVAL_INTRINSIC 157) - (UNSPECV_LWPINS_INTRINSIC 158) ; For AES support (UNSPEC_AESENC 159) @@ -251,7 +247,11 @@ (UNSPECV_RDTSC 18) (UNSPECV_RDTSCP 19) (UNSPECV_RDPMC 20) - (UNSPECV_VSWAPMOV 21) + (UNSPECV_VSWAPMOV 21) + (UNSPECV_LLWP_INTRINSIC 22) + (UNSPECV_SLWP_INTRINSIC 23) + (UNSPECV_LWPVAL_INTRINSIC 24) + (UNSPECV_LWPINS_INTRINSIC 25) ]) ;; Constants to represent pcomtrue/pcomfalse variants @@ -578,7 +578,7 @@ ;; if the instruction is complex. (define_attr "memory" "none,load,store,both,unknown" - (cond [(eq_attr "type" "other,multi,str") + (cond [(eq_attr "type" "other,multi,str,lwp") (const_string "unknown") (eq_attr "type" "lea,fcmov,fpspc") (const_string "none") @@ -20835,113 +20835,86 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define_insn "lwp_llwpcbhi1" - [(unspec [(match_operand:HI 0 "register_operand" "r")] - UNSPEC_LLWP_INTRINSIC)] +(define_expand "lwp_llwpcb" + [(unspec_volatile [(match_operand 0 "register_operand" "r")] + UNSPECV_LLWP_INTRINSIC)] "TARGET_LWP" - "llwpcb\t%0" - [(set_attr "type" "lwp") - (set_attr "mode" "HI")]) - -(define_insn "lwp_llwpcbsi1" - [(unspec [(match_operand:SI 0 "register_operand" "r")] - UNSPEC_LLWP_INTRINSIC)] - "TARGET_LWP" - "llwpcb\t%0" - [(set_attr "type" "lwp") - (set_attr "mode" "SI")]) + "") -(define_insn "lwp_llwpcbdi1" - [(unspec [(match_operand:DI 0 "register_operand" "r")] - UNSPEC_LLWP_INTRINSIC)] +(define_insn "*lwp_llwpcb<mode>1" + [(unspec_volatile [(match_operand:P 0 "register_operand" "r")] + UNSPECV_LLWP_INTRINSIC)] "TARGET_LWP" "llwpcb\t%0" [(set_attr "type" "lwp") - (set_attr "mode" "DI")]) - -(define_insn "lwp_slwpcbhi1" - [(unspec [(match_operand:HI 0 "register_operand" "r")] - UNSPEC_SLWP_INTRINSIC)] - "TARGET_LWP" - "slwpcb\t%0" - [(set_attr "type" "lwp") - (set_attr "mode" "HI")]) + (set_attr "mode" "<MODE>") + (set_attr "length" "5")]) -(define_insn "lwp_slwpcbsi1" - [(unspec [(match_operand:SI 0 "register_operand" "r")] - UNSPEC_SLWP_INTRINSIC)] +(define_expand "lwp_slwpcb" + [(set (match_operand 0 "register_operand" "=r") + (unspec_volatile [(const_int 0)] UNSPECV_SLWP_INTRINSIC))] "TARGET_LWP" - "slwpcb\t%0" - [(set_attr "type" "lwp") - (set_attr "mode" "SI")]) - -(define_insn "lwp_slwpcbdi1" - [(unspec [(match_operand:DI 0 "register_operand" "r")] - UNSPEC_SLWP_INTRINSIC)] + { + if (TARGET_64BIT) + emit_insn (gen_lwp_slwpcbdi (operands[0])); + else + emit_insn (gen_lwp_slwpcbsi (operands[0])); + DONE; + }) + +(define_insn "lwp_slwpcb<mode>" + [(set (match_operand:P 0 "register_operand" "=r") + (unspec_volatile:P [(const_int 0)] UNSPECV_SLWP_INTRINSIC))] "TARGET_LWP" "slwpcb\t%0" [(set_attr "type" "lwp") - (set_attr "mode" "DI")]) - -(define_insn "lwp_lwpvalhi3" - [(unspec_volatile [(match_operand:HI 0 "register_operand" "r") - (match_operand:SI 1 "nonimmediate_operand" "rm") - (match_operand:HI 2 "const_int_operand" "")] - UNSPECV_LWPVAL_INTRINSIC)] - "TARGET_LWP" - "lwpval\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "lwp") - (set_attr "mode" "HI")]) + (set_attr "mode" "<MODE>") + (set_attr "length" "5")]) -(define_insn "lwp_lwpvalsi3" - [(unspec_volatile [(match_operand:SI 0 "register_operand" "r") - (match_operand:SI 1 "nonimmediate_operand" "rm") - (match_operand:SI 2 "const_int_operand" "")] +(define_expand "lwp_lwpval<mode>3" + [(unspec_volatile [(match_operand:SWI48 1 "register_operand" "r") + (match_operand:SI 2 "nonimmediate_operand" "rm") + (match_operand:SI 3 "const_int_operand" "i")] UNSPECV_LWPVAL_INTRINSIC)] "TARGET_LWP" - "lwpval\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "lwp") - (set_attr "mode" "SI")]) + "/* Avoid unused variable warning. */ + (void) operand0;") -(define_insn "lwp_lwpvaldi3" - [(unspec_volatile [(match_operand:DI 0 "register_operand" "r") - (match_operand:SI 1 "nonimmediate_operand" "rm") - (match_operand:SI 2 "const_int_operand" "")] +(define_insn "*lwp_lwpval<mode>3_1" + [(unspec_volatile [(match_operand:SWI48 0 "register_operand" "r") + (match_operand:SI 1 "nonimmediate_operand" "rm") + (match_operand:SI 2 "const_int_operand" "i")] UNSPECV_LWPVAL_INTRINSIC)] "TARGET_LWP" "lwpval\t{%2, %1, %0|%0, %1, %2}" [(set_attr "type" "lwp") - (set_attr "mode" "DI")]) - -(define_insn "lwp_lwpinshi3" - [(unspec_volatile [(match_operand:HI 0 "register_operand" "r") - (match_operand:SI 1 "nonimmediate_operand" "rm") - (match_operand:HI 2 "const_int_operand" "")] - UNSPECV_LWPINS_INTRINSIC)] - "TARGET_LWP" - "lwpins\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "lwp") - (set_attr "mode" "HI")]) + (set_attr "mode" "<MODE>") + (set (attr "length") + (symbol_ref "ix86_attr_length_address_default (insn) + 9"))]) -(define_insn "lwp_lwpinssi3" - [(unspec_volatile [(match_operand:SI 0 "register_operand" "r") - (match_operand:SI 1 "nonimmediate_operand" "rm") - (match_operand:SI 2 "const_int_operand" "")] - UNSPECV_LWPINS_INTRINSIC)] +(define_expand "lwp_lwpins<mode>3" + [(set (reg:CCC FLAGS_REG) + (unspec_volatile:CCC [(match_operand:SWI48 1 "register_operand" "r") + (match_operand:SI 2 "nonimmediate_operand" "rm") + (match_operand:SI 3 "const_int_operand" "i")] + UNSPECV_LWPINS_INTRINSIC)) + (set (match_operand:QI 0 "nonimmediate_operand" "=qm") + (eq:QI (reg:CCC FLAGS_REG) (const_int 0)))] "TARGET_LWP" - "lwpins\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "lwp") - (set_attr "mode" "SI")]) + "") -(define_insn "lwp_lwpinsdi3" - [(unspec_volatile [(match_operand:DI 0 "register_operand" "r") - (match_operand:SI 1 "nonimmediate_operand" "rm") - (match_operand:SI 2 "const_int_operand" "")] - UNSPECV_LWPINS_INTRINSIC)] +(define_insn "*lwp_lwpins<mode>3_1" + [(set (reg:CCC FLAGS_REG) + (unspec_volatile:CCC [(match_operand:SWI48 0 "register_operand" "r") + (match_operand:SI 1 "nonimmediate_operand" "rm") + (match_operand:SI 2 "const_int_operand" "i")] + UNSPECV_LWPINS_INTRINSIC))] "TARGET_LWP" "lwpins\t{%2, %1, %0|%0, %1, %2}" [(set_attr "type" "lwp") - (set_attr "mode" "DI")]) + (set_attr "mode" "<MODE>") + (set (attr "length") + (symbol_ref "ix86_attr_length_address_default (insn) + 9"))]) (include "mmx.md") (include "sse.md") diff --git a/gcc/config/i386/lwpintrin.h b/gcc/config/i386/lwpintrin.h index e5137ec..954b039 100644 --- a/gcc/config/i386/lwpintrin.h +++ b/gcc/config/i386/lwpintrin.h @@ -33,77 +33,68 @@ #else extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__llwpcb16 (void *pcbAddress) +__llwpcb (void *pcbAddress) { - __builtin_ia32_llwpcb16 (pcbAddress); -} - -extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__llwpcb32 (void *pcbAddress) -{ - __builtin_ia32_llwpcb32 (pcbAddress); -} - -extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__llwpcb64 (void *pcbAddress) -{ - __builtin_ia32_llwpcb64 (pcbAddress); -} - -extern __inline void * __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__slwpcb16 (void) -{ - return __builtin_ia32_slwpcb16 (); -} - -extern __inline void * __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__slwpcb32 (void) -{ - return __builtin_ia32_slwpcb32 (); + __builtin_ia32_llwpcb (pcbAddress); } extern __inline void * __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__slwpcb64 (void) +__slwpcb (void) { - return __builtin_ia32_slwpcb64 (); + return __builtin_ia32_slwpcb (); } -extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__lwpval16 (unsigned short data2, unsigned int data1, unsigned short flags) -{ - __builtin_ia32_lwpval16 (data2, data1, flags); -} -/* +#ifdef __OPTIMIZE__ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __lwpval32 (unsigned int data2, unsigned int data1, unsigned int flags) { __builtin_ia32_lwpval32 (data2, data1, flags); } +#ifdef __x86_64__ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__lwpval64 (unsigned __int64 data2, unsigned int data1, unsigned int flags) +__lwpval64 (unsigned long long data2, unsigned int data1, unsigned int flags) { __builtin_ia32_lwpval64 (data2, data1, flags); } +#endif +#else +#define __lwpval32(D2, D1, F) \ + (__builtin_ia32_lwpval32 ((unsigned int) (D2), (unsigned int) (D1), \ + (unsigned int) (F))) +#ifdef __x86_64__ +#define __lwpval64(D2, D1, F) \ + (__builtin_ia32_lwpval64 ((unsigned long long) (D2), (unsigned int) (D1), \ + (unsigned int) (F))) +#endif +#endif -extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__lwpins16 (unsigned short data2, unsigned int data1, unsigned short flags) -{ - return __builtin_ia32_lwpins16 (data2, data1, flags); -} +#ifdef __OPTIMIZE__ extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __lwpins32 (unsigned int data2, unsigned int data1, unsigned int flags) { return __builtin_ia32_lwpins32 (data2, data1, flags); } +#ifdef __x86_64__ extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__lwpins64 (unsigned __int64 data2, unsigned int data1, unsigned int flags) +__lwpins64 (unsigned long long data2, unsigned int data1, unsigned int flags) { return __builtin_ia32_lwpins64 (data2, data1, flags); } -*/ +#endif +#else +#define __lwpins32(D2, D1, F) \ + (__builtin_ia32_lwpins32 ((unsigned int) (D2), (unsigned int) (D1), \ + (unsigned int) (F))) +#ifdef __x86_64__ +#define __lwpins64(D2, D1, F) \ + (__builtin_ia32_lwpins64 ((unsigned long long) (D2), (unsigned int) (D1), \ + (unsigned int) (F))) +#endif +#endif + #endif /* __LWP__ */ #endif /* _LWPINTRIN_H_INCLUDED */ |