Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-14 Thread Uros Bizjak
On Mon, Jan 14, 2013 at 8:01 PM, Andi Kleen wrote: > Well the C++ test cases I wrote didn't work. It may be related to > how complex the program is. Simple calls as in the original > test suite seem to work. > > e.g. instead of xacquire lock and ... it ended up with a cmpxchg loop > (which I thi

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-14 Thread Uros Bizjak
On Mon, Jan 14, 2013 at 8:01 PM, Andi Kleen wrote: >> >> This cannot happen, we reject code that sets both __HLE* flags. >> > >> > BTW I found more HLE bugs, it looks like some of the fetch_op_* >> > patterns do not match always and fall back to cmpxchg, which >> > does not generate HLE code corre

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-14 Thread Andi Kleen
On Mon, Jan 14, 2013 at 07:40:56PM +0100, Uros Bizjak wrote: > On Mon, Jan 14, 2013 at 7:06 PM, Andi Kleen wrote: > >> This cannot happen, we reject code that sets both __HLE* flags. > > > > BTW I found more HLE bugs, it looks like some of the fetch_op_* > > patterns do not match always and fall b

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-14 Thread Uros Bizjak
On Mon, Jan 14, 2013 at 7:06 PM, Andi Kleen wrote: >> This cannot happen, we reject code that sets both __HLE* flags. > > BTW I found more HLE bugs, it looks like some of the fetch_op_* > patterns do not match always and fall back to cmpxchg, which > does not generate HLE code correctly. Not fully

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-14 Thread Andi Kleen
> This cannot happen, we reject code that sets both __HLE* flags. Good thanks. BTW I found more HLE bugs, it looks like some of the fetch_op_* patterns do not match always and fall back to cmpxchg, which does not generate HLE code correctly. Not fully sure what's wrong, can you spot any obvious

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-14 Thread Uros Bizjak
On Sun, Jan 13, 2013 at 11:29 PM, Andi Kleen wrote: > On Sun, Jan 13, 2013 at 11:23:24PM +0100, Uros Bizjak wrote: >> On Sun, Jan 13, 2013 at 11:12 PM, Andi Kleen wrote: >> >> >> +(define_insn "atomic_store_1" >> >> >> + [(set (match_operand:ATOMIC 0 "memory_operand" "=m") >> >> >> + (unspec

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-13 Thread Andi Kleen
On Sun, Jan 13, 2013 at 11:23:24PM +0100, Uros Bizjak wrote: > On Sun, Jan 13, 2013 at 11:12 PM, Andi Kleen wrote: > >> >> +(define_insn "atomic_store_1" > >> >> + [(set (match_operand:ATOMIC 0 "memory_operand" "=m") > >> >> + (unspec:ATOMIC [(match_operand:ATOMIC 1 "" > >> >> "") > >> >> +

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-13 Thread Uros Bizjak
On Sun, Jan 13, 2013 at 11:12 PM, Andi Kleen wrote: >> >> +(define_insn "atomic_store_1" >> >> + [(set (match_operand:ATOMIC 0 "memory_operand" "=m") >> >> + (unspec:ATOMIC [(match_operand:ATOMIC 1 "" >> >> "") >> >> + (match_operand:SI 2 "const_int_operand")] >> >> +

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-13 Thread Andi Kleen
> >> +(define_insn "atomic_store_1" > >> + [(set (match_operand:ATOMIC 0 "memory_operand" "=m") > >> + (unspec:ATOMIC [(match_operand:ATOMIC 1 "" > >> "") > >> + (match_operand:SI 2 "const_int_operand")] > >> +UNSPEC_MOVA))] > >> + "" > >> + "%K2mov{}

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-13 Thread Uros Bizjak
On Sun, Jan 13, 2013 at 9:36 PM, Andi Kleen wrote: >> > __atomic_clear and __atomic_store_n didn't have code to generate >> > the TSX HLE RELEASE prefix. Add this plus test cases. >> >> +(define_insn "atomic_store_hle_release" >> + [(set (match_operand:ATOMIC 0 "memory_operand") >> + (unspec

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-13 Thread Andi Kleen
On Sun, Jan 13, 2013 at 08:59:15PM +0100, Uros Bizjak wrote: > Hello! > > > __atomic_clear and __atomic_store_n didn't have code to generate > > the TSX HLE RELEASE prefix. Add this plus test cases. > > +(define_insn "atomic_store_hle_release" > + [(set (match_operand:ATOMIC 0 "memory_operand")

Re: [PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-13 Thread Uros Bizjak
Hello! > __atomic_clear and __atomic_store_n didn't have code to generate > the TSX HLE RELEASE prefix. Add this plus test cases. +(define_insn "atomic_store_hle_release" + [(set (match_operand:ATOMIC 0 "memory_operand") + (unspec:ATOMIC [(match_operand:ATOMIC 1 "register_operand") +

[PATCH 2/2] Support __ATOMIC_HLE_RELEASE for __atomic_clear/store_n

2013-01-12 Thread Andi Kleen
From: Andi Kleen __atomic_clear and __atomic_store_n didn't have code to generate the TSX HLE RELEASE prefix. Add this plus test cases. Right now it would need another target hook to check for someone passing __ATOMIC_HLE_ACQUIRE to store/clear. I just ignore this for now. Passes bootstrap/test