1# Copyright (c) 2007 The Hewlett-Packard Development Company |
2# Copyright (c) 2015 Advanced Micro Devices, Inc. |
3# All rights reserved. 4# 5# The license below extends only to copyright in the software and shall 6# not be construed as granting a license to any other intellectual 7# property including but not limited to intellectual property relating 8# to a hardware implementation of the functionality of the software 9# licensed hereunder. You may use the software subject to the license 10# terms below provided that you ensure that this notice is replicated --- 111 unchanged lines hidden (view full) --- 122def macroop XADD_R_R { 123 add t2, regm, reg, flags=(OF,SF,ZF,AF,PF,CF) 124 mov regm, regm, reg 125 mov reg, reg, t2 126}; 127 128''' 129 |
130# Despite the name, this microcode sequence implements both 131# cmpxchg8b and cmpxchg16b, depending on the dynamic value 132# of dataSize. |
133cmpxchg8bCode = ''' 134def macroop CMPXCHG8B_%(suffix)s { 135 %(rdip)s 136 lea t1, seg, %(sib)s, disp, dataSize=asz |
137 ldsplit%(l)s (t2, t3), seg, [1, t0, t1], disp=0 |
138 139 sub t0, rax, t2, flags=(ZF,) 140 br label("doneComparing"), flags=(nCZF,) 141 sub t0, rdx, t3, flags=(ZF,) 142doneComparing: 143 144 # If they're equal, set t3:t2 to rbx:rcx to write to memory 145 mov t2, t2, rbx, flags=(CZF,) 146 mov t3, t3, rcx, flags=(CZF,) 147 148 # If they're not equal, set rdx:rax to the value from memory. 149 mov rax, rax, t2, flags=(nCZF,) 150 mov rdx, rdx, t3, flags=(nCZF,) 151 152 # Write to memory |
153 stsplit%(ul)s (t2, t3), seg, [1, t0, t1], disp=0 |
154}; 155''' 156 157microcode += cmpxchg8bCode % {"rdip": "", "sib": "sib", 158 "l": "", "ul": "", 159 "suffix": "M"} 160microcode += cmpxchg8bCode % {"rdip": "rdip t7", "sib": "riprel", 161 "l": "", "ul": "", --- 12 unchanged lines hidden --- |