1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/MachineVerifier/test_copy_physregs_x86.mir
Matt Arsenault bb6d824b20 GlobalISel: Relax verification of physical register copy types
This was picking a concrete size for a physical register, and
enforcing exact match on the virtual register's type size. Some
targets add multiple types to a register class, and some are smaller
than the full bit width. For example x86 adds f32 to 128-bit xmm
registers, and AMDGPU adds i16/f16 to 32-bit registers.

It might be better to represent these cases as a copy of the full
register and an extraction of the subpart, but a lot of code assumes
you can directly copy. This will help fix the current usage of the DAG
calling convention infrastructure which is incompatible with how
GlobalISel is now using it.

The API is somewhat cumbersome here, but I just mirrored the existing
functions, except now with LLTs (and allow returning null on failure,
unlike the MVT version). I think the concept of selecting register
classes based on type is flawed to begin with, but I'm trying to keep
this compatible with the existing handling.
2021-04-28 08:45:41 -04:00

55 lines
1.7 KiB
YAML

#RUN: not --crash llc -march=x86-64 -run-pass=none -verify-machineinstrs -o /dev/null %s 2>&1 | FileCheck %s
# REQUIRES: x86-registered-target
# These copies have mismatched type sizes that are allowed because the
# register class is defined to directly include the narrower type.
---
name: test_valid_copies
tracksRegLiveness: true
body: |
bb.0:
liveins: $xmm0, $xmm1, $xmm2, $xmm3, $xmm4
%0:_(s32) = COPY $xmm0
%1:_(s64) = COPY $xmm1
%2:_(s128) = COPY $xmm2
%3:_(<4 x s32>) = COPY $xmm3
%4:_(<2 x s64>) = COPY $xmm4
$xmm0 = COPY %0
$xmm1 = COPY %1
$xmm2 = COPY %2
$xmm3 = COPY %3
$xmm4 = COPY %4
...
---
name: test_invalid_copies
tracksRegLiveness: true
body: |
bb.0:
liveins: $xmm0, $xmm1, $xmm2, $xmm3
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
%0:_(s16) = COPY $xmm0
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
%1:_(<4 x s16>) = COPY $xmm1
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
%2:_(s256) = COPY $xmm2
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
%3:_(<8 x s32>) = COPY $xmm3
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
$xmm0 = COPY %0
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
$xmm1 = COPY %1
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
$xmm2 = COPY %2
; CHECK: *** Bad machine code: Copy Instruction is illegal with mismatching sizes ***
$xmm3 = COPY %3
...