2019-01-23 03:02:10 +08:00
|
|
|
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -global-isel-abort=2 -pass-remarks-missed='gisel*' -o - 2> %t %s | FileCheck -check-prefix=GFX8 %s
|
|
|
|
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=legalizer -global-isel-abort=2 -o - %s | FileCheck -check-prefix=GFX6 %s
|
|
|
|
# RUN: FileCheck -check-prefixes=ERR %s < %t
|
|
|
|
|
|
|
|
# FIXME: Run with and without unaligned access turned on
|
|
|
|
|
|
|
|
# ERR-NOT: remark
|
|
|
|
# ERR: remark: <unknown>:0:0: unable to legalize instruction: %1:_(<2 x s16>) = G_ZEXTLOAD %0:_(p1) :: (load 2, addrspace 1) (in function: test_zextload_global_v2i16_from_2)
|
|
|
|
# ERR-NEXT: remark: <unknown>:0:0: unable to legalize instruction: %1:_(<2 x s32>) = G_ZEXTLOAD %0:_(p1) :: (load 2, addrspace 1) (in function: test_zextload_global_v2i32_from_2)
|
|
|
|
# ERR-NEXT: remark: <unknown>:0:0: unable to legalize instruction: %1:_(<2 x s32>) = G_ZEXTLOAD %0:_(p1) :: (load 4, addrspace 1) (in function: test_zextload_global_v2i32_from_4)
|
|
|
|
# ERR-NEXT: remark: <unknown>:0:0: unable to legalize instruction: %1:_(<2 x s64>) = G_ZEXTLOAD %0:_(p1) :: (load 4, addrspace 1) (in function: test_zextload_global_v2i64_from_4)
|
|
|
|
# ERR-NEXT: remark: <unknown>:0:0: unable to legalize instruction: %1:_(<2 x s64>) = G_ZEXTLOAD %0:_(p1) :: (load 8, addrspace 1) (in function: test_zextload_global_v2i64_from_8)
|
|
|
|
# ERR-NOT: remark
|
2019-01-23 03:02:10 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_i32_i8
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
; GFX8-LABEL: name: test_zextload_global_i32_i8
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX8: $vgpr0 = COPY [[ZEXTLOAD]](s32)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_i32_i8
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX6: $vgpr0 = COPY [[ZEXTLOAD]](s32)
|
2019-01-23 03:02:10 +08:00
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s32) = G_ZEXTLOAD %0 :: (load 1, addrspace 1)
|
|
|
|
$vgpr0 = COPY %1
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test_zextload_global_i32_i16
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
; GFX8-LABEL: name: test_zextload_global_i32_i16
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX8: $vgpr0 = COPY [[ZEXTLOAD]](s32)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_i32_i16
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX6: $vgpr0 = COPY [[ZEXTLOAD]](s32)
|
2019-01-23 03:02:10 +08:00
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s32) = G_ZEXTLOAD %0 :: (load 2, addrspace 1)
|
|
|
|
$vgpr0 = COPY %1
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test_zextload_global_i31_i8
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
; GFX8-LABEL: name: test_zextload_global_i31_i8
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[ZEXTLOAD]](s32)
|
|
|
|
; GFX8: $vgpr0 = COPY [[COPY1]](s32)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_i31_i8
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[ZEXTLOAD]](s32)
|
|
|
|
; GFX6: $vgpr0 = COPY [[COPY1]](s32)
|
2019-01-23 03:02:10 +08:00
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s31) = G_ZEXTLOAD %0 :: (load 1, addrspace 1)
|
|
|
|
%2:_(s32) = G_ANYEXT %1
|
|
|
|
$vgpr0 = COPY %2
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test_zextload_global_i64_i8
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
; GFX8-LABEL: name: test_zextload_global_i64_i8
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX8: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ZEXTLOAD]](s32)
|
|
|
|
; GFX8: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_i64_i8
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX6: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ZEXTLOAD]](s32)
|
|
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
2019-01-23 03:02:10 +08:00
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s64) = G_ZEXTLOAD %0 :: (load 1, addrspace 1)
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test_zextload_global_i64_i16
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
; GFX8-LABEL: name: test_zextload_global_i64_i16
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX8: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ZEXTLOAD]](s32)
|
|
|
|
; GFX8: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_i64_i16
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX6: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[ZEXTLOAD]](s32)
|
|
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
2019-01-23 03:02:10 +08:00
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s64) = G_ZEXTLOAD %0 :: (load 2, addrspace 1)
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test_zextload_global_i64_i32
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
; GFX8-LABEL: name: test_zextload_global_i64_i32
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 4, addrspace 1)
|
|
|
|
; GFX8: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[LOAD]](s32)
|
|
|
|
; GFX8: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_i64_i32
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 4, addrspace 1)
|
|
|
|
; GFX6: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[LOAD]](s32)
|
|
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
2019-01-23 03:02:10 +08:00
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s64) = G_ZEXTLOAD %0 :: (load 4, addrspace 1)
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
AMDGPU/GlobalISel: Start rewriting load/store legality rules
The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.
The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.
More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.
Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.
The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.
2020-05-24 23:12:11 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_s32_from_2_align1
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
|
|
|
; GFX8-LABEL: name: test_zextload_global_s32_from_2_align1
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX8: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
|
|
|
|
; GFX8: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[C]](s64)
|
|
|
|
; GFX8: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p1) :: (load 1 + 1, addrspace 1)
|
|
|
|
; GFX8: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 255
|
|
|
|
; GFX8: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD]](s32)
|
|
|
|
; GFX8: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C1]]
|
|
|
|
; GFX8: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD1]](s32)
|
|
|
|
; GFX8: [[AND1:%[0-9]+]]:_(s16) = G_AND [[TRUNC1]], [[C1]]
|
|
|
|
; GFX8: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 8
|
|
|
|
; GFX8: [[SHL:%[0-9]+]]:_(s16) = G_SHL [[AND1]], [[C2]](s16)
|
|
|
|
; GFX8: [[OR:%[0-9]+]]:_(s16) = G_OR [[AND]], [[SHL]]
|
|
|
|
; GFX8: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[OR]](s16)
|
|
|
|
; GFX8: $vgpr0 = COPY [[ZEXT]](s32)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_s32_from_2_align1
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX6: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
|
|
|
|
; GFX6: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[C]](s64)
|
|
|
|
; GFX6: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p1) :: (load 1 + 1, addrspace 1)
|
|
|
|
; GFX6: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 255
|
|
|
|
; GFX6: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD]](s32)
|
|
|
|
; GFX6: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C1]]
|
|
|
|
; GFX6: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
|
|
|
|
; GFX6: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
|
|
|
|
; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[LOAD1]](s32)
|
|
|
|
; GFX6: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C3]]
|
|
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C2]](s32)
|
|
|
|
; GFX6: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[SHL]](s32)
|
|
|
|
; GFX6: [[OR:%[0-9]+]]:_(s16) = G_OR [[AND]], [[TRUNC1]]
|
|
|
|
; GFX6: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[OR]](s16)
|
|
|
|
; GFX6: $vgpr0 = COPY [[ZEXT]](s32)
|
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s32) = G_ZEXTLOAD %0 :: (load 2, align 1, addrspace 1)
|
|
|
|
$vgpr0 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_s64_from_2_align1
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
|
|
|
; GFX8-LABEL: name: test_zextload_global_s64_from_2_align1
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX8: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
|
|
|
|
; GFX8: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[C]](s64)
|
|
|
|
; GFX8: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p1) :: (load 1 + 1, addrspace 1)
|
|
|
|
; GFX8: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 255
|
|
|
|
; GFX8: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD]](s32)
|
|
|
|
; GFX8: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C1]]
|
|
|
|
; GFX8: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD1]](s32)
|
|
|
|
; GFX8: [[AND1:%[0-9]+]]:_(s16) = G_AND [[TRUNC1]], [[C1]]
|
|
|
|
; GFX8: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 8
|
|
|
|
; GFX8: [[SHL:%[0-9]+]]:_(s16) = G_SHL [[AND1]], [[C2]](s16)
|
|
|
|
; GFX8: [[OR:%[0-9]+]]:_(s16) = G_OR [[AND]], [[SHL]]
|
|
|
|
; GFX8: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[OR]](s16)
|
|
|
|
; GFX8: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_s64_from_2_align1
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 1, addrspace 1)
|
|
|
|
; GFX6: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
|
|
|
|
; GFX6: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[C]](s64)
|
|
|
|
; GFX6: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p1) :: (load 1 + 1, addrspace 1)
|
|
|
|
; GFX6: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 255
|
|
|
|
; GFX6: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD]](s32)
|
|
|
|
; GFX6: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C1]]
|
|
|
|
; GFX6: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
|
|
|
|
; GFX6: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
|
|
|
|
; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[LOAD1]](s32)
|
|
|
|
; GFX6: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C3]]
|
|
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C2]](s32)
|
|
|
|
; GFX6: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[SHL]](s32)
|
|
|
|
; GFX6: [[OR:%[0-9]+]]:_(s16) = G_OR [[AND]], [[TRUNC1]]
|
|
|
|
; GFX6: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[OR]](s16)
|
|
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
|
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s64) = G_ZEXTLOAD %0 :: (load 2, align 1, addrspace 1)
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_v2i16_from_2
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
|
|
|
; GFX8-LABEL: name: test_zextload_global_v2i16_from_2
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s16>) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX8: $vgpr0 = COPY [[ZEXTLOAD]](<2 x s16>)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_v2i16_from_2
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s16>) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX6: $vgpr0 = COPY [[ZEXTLOAD]](<2 x s16>)
|
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(<2 x s16>) = G_ZEXTLOAD %0 :: (load 2, addrspace 1)
|
|
|
|
$vgpr0 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_v2i32_from_2
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
|
|
|
; GFX8-LABEL: name: test_zextload_global_v2i32_from_2
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s32>) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX8: $vgpr0_vgpr1 = COPY [[ZEXTLOAD]](<2 x s32>)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_v2i32_from_2
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s32>) = G_ZEXTLOAD [[COPY]](p1) :: (load 2, addrspace 1)
|
|
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[ZEXTLOAD]](<2 x s32>)
|
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(<2 x s32>) = G_ZEXTLOAD %0 :: (load 2, addrspace 1)
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_v2i32_from_4
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
|
|
|
; GFX8-LABEL: name: test_zextload_global_v2i32_from_4
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s32>) = G_ZEXTLOAD [[COPY]](p1) :: (load 4, addrspace 1)
|
|
|
|
; GFX8: $vgpr0_vgpr1 = COPY [[ZEXTLOAD]](<2 x s32>)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_v2i32_from_4
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s32>) = G_ZEXTLOAD [[COPY]](p1) :: (load 4, addrspace 1)
|
|
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[ZEXTLOAD]](<2 x s32>)
|
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(<2 x s32>) = G_ZEXTLOAD %0 :: (load 4, addrspace 1)
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_v2i64_from_4
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
|
|
|
; GFX8-LABEL: name: test_zextload_global_v2i64_from_4
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s64>) = G_ZEXTLOAD [[COPY]](p1) :: (load 4, addrspace 1)
|
|
|
|
; GFX8: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[ZEXTLOAD]](<2 x s64>)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_v2i64_from_4
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s64>) = G_ZEXTLOAD [[COPY]](p1) :: (load 4, addrspace 1)
|
|
|
|
; GFX6: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[ZEXTLOAD]](<2 x s64>)
|
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(<2 x s64>) = G_ZEXTLOAD %0 :: (load 4, addrspace 1)
|
|
|
|
$vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_zextload_global_v2i64_from_8
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
|
|
|
|
; GFX8-LABEL: name: test_zextload_global_v2i64_from_8
|
|
|
|
; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s64>) = G_ZEXTLOAD [[COPY]](p1) :: (load 8, addrspace 1)
|
|
|
|
; GFX8: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[ZEXTLOAD]](<2 x s64>)
|
|
|
|
; GFX6-LABEL: name: test_zextload_global_v2i64_from_8
|
|
|
|
; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
; GFX6: [[ZEXTLOAD:%[0-9]+]]:_(<2 x s64>) = G_ZEXTLOAD [[COPY]](p1) :: (load 8, addrspace 1)
|
|
|
|
; GFX6: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[ZEXTLOAD]](<2 x s64>)
|
|
|
|
%0:_(p1) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(<2 x s64>) = G_ZEXTLOAD %0 :: (load 8, addrspace 1)
|
|
|
|
$vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
|
|
|
|
...
|