[Bug tree-optimization/15089] local register variable with a specified register is bad

2018-10-24 Thread ilya.lesokhin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15089

Ilya Lesokhin  changed:

   What|Removed |Added

 CC||ilya.lesokhin at gmail dot com

--- Comment #26 from Ilya Lesokhin  ---
Created attachment 44888
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44888=edit
Test case demonstrating the problem

Looks like issue still exists.

#include 


uint64_t test() {
  register uint64_t t0;
  register uint64_t t1;
  register uint64_t t2 ;
  register uint64_t rdx;
  register uint64_t r0 asm("rsi");
  register uint64_t r1 ;
  register uint64_t r2 ;
  register uint64_t r3 ;
  register uint64_t m3;
  register uint64_t y0;
  register uint64_t y1;
  register uint64_t y2;
  register uint64_t y3;


  asm(
 "mov %[res0],%[res0]"
  : "="(rdx), [res0] "="(r0), [res1] "="(r1), [res2] "="(r2),
[res3] "="(r3),
[t0] "="(t0), [t1] "="(t1), [t2] "="(t2)
  : [m3] "r"(m3), [y0] "r"(y0), [y1] "r"(y1), [y2] "r"(y2)
  : "cc");



return r0;
}

Results in:

test():
 push   %r14
 xor%eax,%eax
 xor%ecx,%ecx
 push   %rbp
 xor%esi,%esi
 xor%edi,%edi
 push   %rbx
 mov%r14,%r14  <- should be rsi.
 mov%r14,%rax
 pop%rbx
 pop%rbp
 pop%r14
 retq   


https://godbolt.org/z/RLTDbY

[Bug inline-asm/43998] inline assembler: can't set clobbering for input register

2013-04-08 Thread ilya.lesokhin at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43998



Ilya Lesokhin ilya.lesokhin at gmail dot com changed:



   What|Removed |Added



 CC||ilya.lesokhin at gmail dot

   ||com



--- Comment #13 from Ilya Lesokhin ilya.lesokhin at gmail dot com 2013-04-08 
08:04:28 UTC ---

Andrew Pinski said:

  Use an output register that says it clobbers that register.



This indeed works for normal inline assembler, but it doesn't work for asm goto

which currently doesn't have outputs.



maybe the Bug should be reopened for newer versions of GCC?


[Bug target/41894] wrong code with -fno-split-wide-types

2011-05-21 Thread ilya.lesokhin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41894

--- Comment #12 from Ilya Lesokhin ilya.lesokhin at gmail dot com 2011-05-21 
14:47:33 UTC ---
Created attachment 24319
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24319
simple test case

i belive this is the same bug.

the problem occurs when using r28,r29 and accesing one of them.

as can be seen badCode() doesnt put the value 5 in tester. while goodCode does.


void badCode()
{
  a4:ef 92   pushr14
  a6:ff 92   pushr15
  a8:cf 93   pushr28
  aa:df 93   pushr29
} t;

t.deletedbyte = 5;
asm (: +y (t) :);

t.otherbyte = 17;
  ac:81 e1   ldir24, 0x11; 17
  ae:ec 01   movwr28, r24

asm (: +y (t) :);

tester = t.deletedbyte;
  b0:7e 01   movwr14, r28
  b2:f0 92 00 01 sts0x0100, r15
}
  b6:df 91   popr29
  b8:cf 91   popr28
  ba:ff 90   popr15
  bc:ef 90   popr14
  be:08 95   ret

00c0 goodCode:

void goodCode()
{
  c0:a0 e0   ldir26, 0x00; 0
  c2:b5 e0   ldir27, 0x05; 5
} t;

t.deletedbyte = 5;
asm (: +x (t) :);

t.otherbyte = 17;
  c4:a1 e1   ldir26, 0x11; 17

asm (: +x (t) :);

tester = t.deletedbyte;
  c6:b0 93 00 01 sts0x0100, r27
}
  ca:08 95   ret