<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55411>55411</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [s390] integrated assembler miscompiles mvc+clc instructions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hcahca
      </td>
    </tr>
</table>

<pre>
    Compiling this simple test program:
```
test:
        mvc     32(8,%r0),.Lsomething
        clc     0(1,%r1),.Lsomething
.Lsomething:
        .quad   0
```
with `clang  --target=s390x-linux-gnu -fintegrated-as -m64 test.S` results in an object file with incorrect relocations for the second displacement of the mvc and clc instructions:
```
> objdump -hdr test.o
Disassembly of section .text:
0000000000000000 <test>:
   0:   d2 07 00 20 00 00       mvc     32(8,%r0),0
                        2: R_390_12     .text+0xc
   6:   d5 00 10 00 00 00       clc     0(1,%r1),0
                        8: R_390_12     .text+0xc
```

Compare this with the result when using gcc/gas `gcc -c test.S`:

```
> objdump -hdr test.o 
Disassembly of section .text:
0000000000000000 <test>:
   0:   d2 07 00 20 00 00       mvc     32(8,%r0),0
                        4: R_390_12     .text+0xc
   6:   d5 00 10 00 00 00       clc     0(1,%r1),0
                        a: R_390_12     .text+0xc
```

FWIW, as reference: this causes a miscompile for the Linux Kernel on s390: https://lore.kernel.org/linux-s390/Ynwh%2FUk3IyiyRzO3@dev-arch.thelio-3990X/T/#m57bd178adca225e8822d65d796dbec33c7ac0de6

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVduO1DgQ_Zr0SymR43RuD3mAGVpCi4QEi2CfkONUJwbH6bWduezXU3Y30zOthRH7ssKykvhSdarOsSv9Mtx3V8t8UFqZEfykHDg1HzSCR-fhYJfRijkpXiTsOmEvkoqdehyGPQ9rcGrzjYzvgie8aRJ-lfDSsoS39Jm9ccuMBGPGp0ZSH41oX5OfbPIf2DyeuATP_l7FEP38W7y3yk9AI6kFZQtp6oUdkVK4dkXL7lIiYb1LR7NCulfGI-XucUiFg3SutpGS7D3Zg0W3au9AGRAGlv4LSg97RbRFCGXkYm2Ys6gXKbxajIP9YolhBIdyMQMMyh20kDij8bDs41LgTtBaoEMZ5-0qo-2PBEiKVwF9WOcDpNNgjyEux8Vr5YRzOPf6Pvgn2OALMo93Z9XYRYOkuDrK-uoxuYwG9Bo4sBpoF2fhSf15zdlThS4bD57ffSb-P-f8qGEMkL9kd_LBtDrhlwEz_w7-gP-T4_MMfPM8_CXn8RkujbB4vDJR9KDf8VzA7YQGVheu1ChlwncjHSFyQANI5fkcnWX9BXHhd1J3-_-qK_6juruPrz-SdyDZLO7RopEYXEW1pVgdOhAwKydj7cSHu_0mVBD4A61BDSRHqCvBcPL-EG8x31HXi8Xsa9yULXYMM7HyxN1895e5nShHvvvwtXh9r-7f_fO2SLZswJtUWDllBKTVkhZtyz7R9j-j02Iu637I60YMUnBeYtNwPlTlULfV0KMsClkLSU6qY4qboSuGtmjFxiuvsUvKlxG-vIZz6YPTEUP7KFkXDgRReFmkNqvV3dNER7oYa5-RYchR33x_pfRjCTWThsq5FR19lOU2zzdTVwku2yrnRVmLvmY573NWVQ1vRZ-XRVVvtOhRuxBwwrnBW4gu6Jti36iOM85ZmfO8ZXzLs7JBljMccsEaXteMiMRZKJ2FOAL7G9vFkPp1dLSolfPuvEgEqNFg5Cf4F6ufFttNUlDfROQuRv4NtQMCog">