<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/test/CodeGen/M68k/CodeModel, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[M68k] Fix incorrect boolean content type (#152572)</title>
<updated>2025-08-12T15:46:41+00:00</updated>
<author>
<name>Dan Salvato</name>
<email>dansalvato1@gmail.com</email>
</author>
<published>2025-08-12T15:46:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b09b05a83ef781da8a967702488d10d4e5e6216d'/>
<id>b09b05a83ef781da8a967702488d10d4e5e6216d</id>
<content type='text'>
M68k's SETCC instruction (`scc`) distinctly fills the destination byte
with all 1s. If boolean contents are set to `ZeroOrOneBooleanContent`,
LLVM can mistakenly think the destination holds `0x01` instead of `0xff`
and emit broken code as a result. This change corrects the boolean
content type to `ZeroOrNegativeOneBooleanContent`.

For example, this IR:

```llvm
define dso_local signext range(i8 0, 2) i8 @testBool(i32 noundef %a) local_unnamed_addr #0 {
entry:
  %cmp = icmp eq i32 %a, 4660
  %. = zext i1 %cmp to i8
  ret i8 %.
}
```

would previously build as:

```asm
testBool:                               ; @testBool
	cmpi.l	#4660, (4,%sp)
	seq	%d0
	and.l	#255, %d0
	rts
```

Notice the `zext` is erroneously not clearing the low bits, and thus the
register returns with 255 instead of 1. This patch fixes the issue:

```asm
testBool:                               ; @testBool
	cmpi.l	#4660, (4,%sp)
	seq	%d0
	and.l	#1, %d0
	rts
```

Most of the tests containing `scc` suffered from the same value error as
described above, so those tests have been updated to match the new
output (which also logically corrects them).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
M68k's SETCC instruction (`scc`) distinctly fills the destination byte
with all 1s. If boolean contents are set to `ZeroOrOneBooleanContent`,
LLVM can mistakenly think the destination holds `0x01` instead of `0xff`
and emit broken code as a result. This change corrects the boolean
content type to `ZeroOrNegativeOneBooleanContent`.

For example, this IR:

```llvm
define dso_local signext range(i8 0, 2) i8 @testBool(i32 noundef %a) local_unnamed_addr #0 {
entry:
  %cmp = icmp eq i32 %a, 4660
  %. = zext i1 %cmp to i8
  ret i8 %.
}
```

would previously build as:

```asm
testBool:                               ; @testBool
	cmpi.l	#4660, (4,%sp)
	seq	%d0
	and.l	#255, %d0
	rts
```

Notice the `zext` is erroneously not clearing the low bits, and thus the
register returns with 255 instead of 1. This patch fixes the issue:

```asm
testBool:                               ; @testBool
	cmpi.l	#4660, (4,%sp)
	seq	%d0
	and.l	#1, %d0
	rts
```

Most of the tests containing `scc` suffered from the same value error as
described above, so those tests have been updated to match the new
output (which also logically corrects them).</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k] Add remaining addressing modes for Atomic operations (#115523)</title>
<updated>2024-12-12T17:11:23+00:00</updated>
<author>
<name>knickish</name>
<email>knickish@gmail.com</email>
</author>
<published>2024-12-12T17:11:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4cce10743d2275710d3d2e0de8013386a9799092'/>
<id>4cce10743d2275710d3d2e0de8013386a9799092</id>
<content type='text'>
Had been doing this piece by piece, but makes more sense to do it in a
single PR. Adds support for `ARID`, `PCI`, `PCD`, `AL`, and `ARD`
addressing modes for atomic operations, along with a variety of tests.

The `CodeModel` tests have been rearranged, as some of the new
addressing modes are only exercised under some combinations of
`CodeModel` and relocation mode</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Had been doing this piece by piece, but makes more sense to do it in a
single PR. Adds support for `ARID`, `PCI`, `PCD`, `AL`, and `ARD`
addressing modes for atomic operations, along with a variety of tests.

The `CodeModel` tests have been rearranged, as some of the new
addressing modes are only exercised under some combinations of
`CodeModel` and relocation mode</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k] implement large code model (#106381)</title>
<updated>2024-11-08T05:46:52+00:00</updated>
<author>
<name>Janis Heims</name>
<email>janis.heims@undertheprinter.com</email>
</author>
<published>2024-11-08T05:46:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2f40e3e713efb550c05ff5f911ab4ce2e4a8dddf'/>
<id>2f40e3e713efb550c05ff5f911ab4ce2e4a8dddf</id>
<content type='text'>
Fixes #106208.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #106208.</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k] Correctly emit non-pic relocations (#89863)</title>
<updated>2024-05-03T15:14:56+00:00</updated>
<author>
<name>Peter Lafreniere</name>
<email>peter@n8pjl.ca</email>
</author>
<published>2024-05-03T15:14:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ebbc5de7db45b2fc81564a6c870a57f4b95d0477'/>
<id>ebbc5de7db45b2fc81564a6c870a57f4b95d0477</id>
<content type='text'>
The m68k backend will always emit external calls (including libcalls)
with
PC-relative PLT relocations, even when in non-pic mode or -fno-plt is
used.

This is unexpected, as other function calls are emitted with absolute
addressing, and a static code modes suggests that there is no PLT. It
also
leads to a miscompilation where the call instruction emitted expects an
immediate address, while the relocation emitted for that instruction is
PC-relative.

This miscompilation can even be seen in the default C function in
godbolt:
https://godbolt.org/z/zEoazovzo

Fix the issue by classifying external function references based upon the
pic
mode. This triggers a change in the static code model, making it more in
line
with the expected behaviour and allowing use of this backend in more
bare-metal
situations where a PLT does not exist.

The change avoids the issue where we emit a PLT32 relocation for an
absolute
call, and makes libcalls and other external calls use absolute
addressing modes
when a static code model is desired.

Further work should be done in instruction lowering and validation to
ensure
that miscompilations of the same type don't occur.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The m68k backend will always emit external calls (including libcalls)
with
PC-relative PLT relocations, even when in non-pic mode or -fno-plt is
used.

This is unexpected, as other function calls are emitted with absolute
addressing, and a static code modes suggests that there is no PLT. It
also
leads to a miscompilation where the call instruction emitted expects an
immediate address, while the relocation emitted for that instruction is
PC-relative.

This miscompilation can even be seen in the default C function in
godbolt:
https://godbolt.org/z/zEoazovzo

Fix the issue by classifying external function references based upon the
pic
mode. This triggers a change in the static code model, making it more in
line
with the expected behaviour and allowing use of this backend in more
bare-metal
situations where a PLT does not exist.

The change avoids the issue where we emit a PLT32 relocation for an
absolute
call, and makes libcalls and other external calls use absolute
addressing modes
when a static code model is desired.

Further work should be done in instruction lowering and validation to
ensure
that miscompilations of the same type don't occur.</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k] Add support for MOVEQ instruction (#88542)</title>
<updated>2024-04-26T12:34:21+00:00</updated>
<author>
<name>Peter Lafreniere</name>
<email>peter@n8pjl.ca</email>
</author>
<published>2024-04-26T12:34:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c4c9d4f306732c854fa88d2f30c1a22bb025d0c9'/>
<id>c4c9d4f306732c854fa88d2f30c1a22bb025d0c9</id>
<content type='text'>
Add support for the moveq instruction, which is both faster and smaller
(1/2 to 1/3 the size) than a move with immediate to register.

This change introduces the instruction, along with a set of
pseudoinstructions to handle immediate moves to a register that is
lowered post-RA.

Pseudos are used as moveq can only write to the full register, which
makes
matching i8 and i16 immediate loads difficult in tablegen. Furthermore,
selecting moveq before RA constrains that immediate to be moved into a
data
register, which may not be optimal.

The bulk of this change are fixes to existing tests, which cover the new
functionality sufficiently.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add support for the moveq instruction, which is both faster and smaller
(1/2 to 1/3 the size) than a move with immediate to register.

This change introduces the instruction, along with a set of
pseudoinstructions to handle immediate moves to a register that is
lowered post-RA.

Pseudos are used as moveq can only write to the full register, which
makes
matching i8 and i16 immediate loads difficult in tablegen. Furthermore,
selecting moveq before RA constrains that immediate to be moved into a
data
register, which may not be optimal.

The bulk of this change are fixes to existing tests, which cover the new
functionality sufficiently.</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k] Convert tests to opaque pointers (NFC)</title>
<updated>2024-02-06T20:53:16+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2024-02-06T20:53:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cd0d11be7a6de335dcfcf2788a97d915f017e25e'/>
<id>cd0d11be7a6de335dcfcf2788a97d915f017e25e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update m68k tests to new block placement</title>
<updated>2023-10-25T18:33:56+00:00</updated>
<author>
<name>Matthias Braun</name>
<email>matze@braunis.de</email>
</author>
<published>2023-10-25T17:11:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=94aaaf4fb49c7057a9060a3d7888bdfb0c40734d'/>
<id>94aaaf4fb49c7057a9060a3d7888bdfb0c40734d</id>
<content type='text'>
e3cf80c5c1fe55efd8216575ccadea0ab087e79c affected block placement of
some tests in the experimental m68k target. This updates them.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
e3cf80c5c1fe55efd8216575ccadea0ab087e79c affected block placement of
some tests in the experimental m68k target. This updates them.
</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k] Fix CConvs for pointer type return values</title>
<updated>2023-03-24T18:00:35+00:00</updated>
<author>
<name>Min-Yih Hsu</name>
<email>minyihh@uci.edu</email>
</author>
<published>2023-03-24T17:59:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=70511e61761eb7d1c4fb5ff1a8383ced18843753'/>
<id>70511e61761eb7d1c4fb5ff1a8383ced18843753</id>
<content type='text'>
Put the value into A0 instead of data registers. And remove the
redundant `RetCC_M68kCommon` as there aren't many rules shared between
existing CCs other than the pointer one.
This change is tested by existing tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Put the value into A0 instead of data registers. And remove the
redundant `RetCC_M68kCommon` as there aren't many rules shared between
existing CCs other than the pointer one.
This change is tested by existing tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k][NFC] Use OS and ABI agnostic triple in codegen tests</title>
<updated>2022-10-23T22:26:13+00:00</updated>
<author>
<name>Min-Yih Hsu</name>
<email>minyihh@uci.edu</email>
</author>
<published>2022-10-23T21:36:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=718a9793b4724b42ab411bb869623bb7e34c2e3d'/>
<id>718a9793b4724b42ab411bb869623bb7e34c2e3d</id>
<content type='text'>
Use 'm68k' (i.e. m68k-unknown-unknown) in all codegen tests rather
than m68k-linux-gnu. NFC.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use 'm68k' (i.e. m68k-unknown-unknown) in all codegen tests rather
than m68k-linux-gnu. NFC.
</pre>
</div>
</content>
</entry>
<entry>
<title>[M68k] Adopt VarLenCodeEmitter for move instructions</title>
<updated>2022-04-05T06:02:27+00:00</updated>
<author>
<name>Min-Yih Hsu</name>
<email>minyihh@uci.edu</email>
</author>
<published>2021-12-18T12:09:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=18b38ff6c7f1879a529529c5a4e8c19f17cef9cc'/>
<id>18b38ff6c7f1879a529529c5a4e8c19f17cef9cc</id>
<content type='text'>
The `move` instruction has one of the most complicate sets of variants, so
we're refactoring it first before finishing up rest of the data
instructions in a separate patch.

Note that since we're introducing more `move` variants, the codegen
actually got improved in terms of code size.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `move` instruction has one of the most complicate sets of variants, so
we're refactoring it first before finishing up rest of the data
instructions in a separate patch.

Note that since we're introducing more `move` variants, the codegen
actually got improved in terms of code size.
</pre>
</div>
</content>
</entry>
</feed>
