Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Compiler Errors (Emit wrong registers)

hyungseok
Beginner
244 Views

I discovered that the latest x86-64 ICX 2024.0.0 generates incorrect registers.

This error has been identified in 15 opcodes.

 

Buggy code.

```

void bug(int num) {
__asm__( ".intel_syntax noprefix\n"
"nop\n"
"cmpbexadd [RAX+1], EBP, R9D\n"
"cmpbxadd [RAX+1], EBP, R9D\n"
"cmplexadd [RAX+1], EBP, R9D\n"
"cmpbexadd [RAX+1], EBP, R9D\n"
"cmplxadd [RAX+1], EBP, R9D\n"
"cmpnbexadd [RAX+1], EBP, R9D\n"
"cmpnbxadd [RAX+1], EBP, R9D\n"
"cmpnlxadd [RAX+1], EBP, R9D\n"
"cmpnoxadd [RAX+1], EBP, R9D\n"
"cmpnpxadd [RAX+1], EBP, R9D\n"
"cmpnsxadd [RAX+1], EBP, R9D\n"
"cmpnzxadd [RAX+1], EBP, R9D\n"
"cmppxadd [RAX+1], EBP, R9D\n"
"cmpsxadd [RAX+1], EBP, R9D\n"
"cmpzxadd [RAX+1], EBP, R9D\n"
"nop\n"
);
}
```
 
Compiled Code
```
bug:
push rbp
mov rbp,rsp
mov DWORD PTR [rbp-0x4],edi
nop
cmpbexadd DWORD PTR [rax+0x1],r13d,r9d
cmpbxadd DWORD PTR [rax+0x1],r13d,r9d
cmplexadd DWORD PTR [rax+0x1],r13d,r9d
cmpbexadd DWORD PTR [rax+0x1],r13d,r9d
cmplxadd DWORD PTR [rax+0x1],r13d,r9d
cmpnbexadd DWORD PTR [rax+0x1],r13d,r9d
cmpnbxadd DWORD PTR [rax+0x1],r13d,r9d
cmpnlxadd DWORD PTR [rax+0x1],r13d,r9d
cmpnoxadd DWORD PTR [rax+0x1],r13d,r9d
cmpnpxadd DWORD PTR [rax+0x1],r13d,r9d
cmpnsxadd DWORD PTR [rax+0x1],r13d,r9d
cmpnzxadd DWORD PTR [rax+0x1],r13d,r9d
cmppxadd DWORD PTR [rax+0x1],r13d,r9d
cmpsxadd DWORD PTR [rax+0x1],r13d,r9d
cmpzxadd DWORD PTR [rax+0x1],r13d,r9d
nop
pop rbp
ret
```
 

I tested it through godbolt.

https://godbolt.org/z/1hrhMWY39

0 Kudos
2 Replies
Alex_Y_Intel
Moderator
137 Views

I've escalated your case to our internal engineering team. 

0 Kudos
Alex_Y_Intel
Moderator
103 Views

The fix is expected be in compiler version 2025.0 release. 

0 Kudos
Reply