diff --git a/.gitattributes b/.gitattributes index 222a15080c..8a2bb4de10 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14929,6 +14929,7 @@ tests/webtbs/tw2942b.pp svneol=native#text/plain tests/webtbs/tw2943.pp svneol=native#text/plain tests/webtbs/tw2944.pp svneol=native#text/plain tests/webtbs/tw2946.pp svneol=native#text/plain +tests/webtbs/tw29471.pp svneol=native#text/plain tests/webtbs/tw2949.pp svneol=native#text/plain tests/webtbs/tw2953.pp svneol=native#text/plain tests/webtbs/tw29546.pp svneol=native#text/pascal diff --git a/compiler/x86/cpubase.pas b/compiler/x86/cpubase.pas index 2292ca54df..cb3066d837 100644 --- a/compiler/x86/cpubase.pas +++ b/compiler/x86/cpubase.pas @@ -183,9 +183,6 @@ uses {$endif} const -{ TODO: Calculate bsstart} - regnumber_count_bsstart = 64; - regnumber_table : array[tregisterindex] of tregister = ( {$if defined(x86_64)} {$i r8664num.inc} diff --git a/compiler/x86/itcpugas.pas b/compiler/x86/itcpugas.pas index 37eb631cb3..d1a9388fcb 100644 --- a/compiler/x86/itcpugas.pas +++ b/compiler/x86/itcpugas.pas @@ -105,11 +105,11 @@ interface implementation uses - cutils,verbose; + cutils,verbose,rgbase; const {$if defined(x86_64)} - att_regname_table : array[tregisterindex] of string[7] = ( + att_regname_table : TRegNameTable = ( {r8664att.inc contains the AT&T name of each register.} {$i r8664att.inc} ); @@ -120,7 +120,7 @@ implementation {$i r8664ari.inc} ); {$elseif defined(i386)} - att_regname_table : array[tregisterindex] of string[7] = ( + att_regname_table : TRegNameTable = ( {r386att.inc contains the AT&T name of each register.} {$i r386att.inc} ); @@ -131,7 +131,7 @@ implementation {$i r386ari.inc} ); {$elseif defined(i8086)} - att_regname_table : array[tregisterindex] of string[7] = ( + att_regname_table : TRegNameTable = ( {r8086att.inc contains the AT&T name of each register.} {$i r8086att.inc} ); @@ -143,28 +143,11 @@ implementation ); {$endif} - function findreg_by_attname(const s:string):byte; - var - i,p : tregisterindex; - begin - {Binary search.} - p:=0; - i:=regnumber_count_bsstart; - repeat - if (p+i<=high(tregisterindex)) and (att_regname_table[att_regname_index[p+i]]<=s) then - p:=p+i; - i:=i shr 1; - until i=0; - if att_regname_table[att_regname_index[p]]=s then - findreg_by_attname:=att_regname_index[p] - else - findreg_by_attname:=0; - end; function gas_regnum_search(const s:string):Tregister; begin - result:=regnumber_table[findreg_by_attname(s)]; + result:=regnumber_table[findreg_by_name_table(s,att_regname_table,att_regname_index)]; end; diff --git a/tests/webtbs/tw29471.pp b/tests/webtbs/tw29471.pp new file mode 100644 index 0000000000..edf8091eba --- /dev/null +++ b/tests/webtbs/tw29471.pp @@ -0,0 +1,24 @@ +{ %cpu=x86_64 } +{ %norun } +program avxtest; + + {$ASMMODE ATT} + + type + TSIMDWord = packed array[0..3] of Double; + + procedure SIMDAddWord(var A, B, ARes);assembler; + asm + vmovdqu (%rdi), %ymm2 // <- error 1 + vmovdqu (%rsi), %ymm1 + vaddpd %ymm1, %ymm2, %ymm0 // <- error 2 + vmovdqu %ymm0, (%rdx) + end; + + var + V1, V2, Res : TSIMDWord; + + begin + SIMDAddWord(V1, V2, Res); + end. + \ No newline at end of file