You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
312 lines
11 KiB
312 lines
11 KiB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
|
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX6 %s
|
|
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX9 %s
|
|
|
|
# Can't narrow this; need known bits
|
|
---
|
|
name: shl_s64_by_2_from_anyext_s32
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: shl_s64_by_2_from_anyext_s32
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
; GFX6: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
|
|
; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[ANYEXT]], [[C]](s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[SHL]](s64)
|
|
; GFX9-LABEL: name: shl_s64_by_2_from_anyext_s32
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
; GFX9: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
|
|
; GFX9: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[ANYEXT]], [[C]](s32)
|
|
; GFX9: $vgpr0_vgpr1 = COPY [[SHL]](s64)
|
|
%0:_(s32) = COPY $vgpr0
|
|
%1:_(s64) = G_ANYEXT %0
|
|
%2:_(s32) = G_CONSTANT i32 2
|
|
%3:_(s64) = G_SHL %1, %2
|
|
$vgpr0_vgpr1 = COPY %3
|
|
...
|
|
|
|
# Can't narrow this; need known bits
|
|
---
|
|
name: shl_s64_by_2_from_sext_s32
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: shl_s64_by_2_from_sext_s32
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
; GFX6: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s32)
|
|
; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[SEXT]], [[C]](s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[SHL]](s64)
|
|
; GFX9-LABEL: name: shl_s64_by_2_from_sext_s32
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
; GFX9: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s32)
|
|
; GFX9: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[SEXT]], [[C]](s32)
|
|
; GFX9: $vgpr0_vgpr1 = COPY [[SHL]](s64)
|
|
%0:_(s32) = COPY $vgpr0
|
|
%1:_(s64) = G_SEXT %0
|
|
%2:_(s32) = G_CONSTANT i32 2
|
|
%3:_(s64) = G_SHL %1, %2
|
|
$vgpr0_vgpr1 = COPY %3
|
|
...
|
|
|
|
# Can't narrow this; need known bits
|
|
---
|
|
name: shl_s64_by_2_from_zext_s32
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: shl_s64_by_2_from_zext_s32
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
; GFX6: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
|
|
; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[ZEXT]], [[C]](s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY [[SHL]](s64)
|
|
; GFX9-LABEL: name: shl_s64_by_2_from_zext_s32
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
; GFX9: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
|
|
; GFX9: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[ZEXT]], [[C]](s32)
|
|
; GFX9: $vgpr0_vgpr1 = COPY [[SHL]](s64)
|
|
%0:_(s32) = COPY $vgpr0
|
|
%1:_(s64) = G_ZEXT %0
|
|
%2:_(s32) = G_CONSTANT i32 2
|
|
%3:_(s64) = G_SHL %1, %2
|
|
$vgpr0_vgpr1 = COPY %3
|
|
...
|
|
|
|
---
|
|
name: narrow_shl_s64_by_2_from_anyext_s32
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: narrow_shl_s64_by_2_from_anyext_s32
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX6: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX6: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX6: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
; GFX9-LABEL: name: narrow_shl_s64_by_2_from_anyext_s32
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX9: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX9: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX9: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX9: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX9: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
%narrow:_(s32) = COPY $vgpr0
|
|
%masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
%masked:_(s32) = G_AND %narrow, %masklow30
|
|
%extend:_(s64) = G_ANYEXT %masked
|
|
%shiftamt:_(s32) = G_CONSTANT i32 2
|
|
%shl:_(s64) = G_SHL %extend, %shiftamt
|
|
$vgpr0_vgpr1 = COPY %shl
|
|
...
|
|
|
|
---
|
|
name: narrow_shl_s64_by_2_from_zext_s32
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: narrow_shl_s64_by_2_from_zext_s32
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX6: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX6: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX6: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
; GFX9-LABEL: name: narrow_shl_s64_by_2_from_zext_s32
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX9: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX9: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX9: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX9: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX9: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
%narrow:_(s32) = COPY $vgpr0
|
|
%masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
%masked:_(s32) = G_AND %narrow, %masklow30
|
|
%extend:_(s64) = G_ZEXT %masked
|
|
%shiftamt:_(s32) = G_CONSTANT i32 2
|
|
%shl:_(s64) = G_SHL %extend, %shiftamt
|
|
$vgpr0_vgpr1 = COPY %shl
|
|
...
|
|
|
|
---
|
|
name: narrow_shl_s64_by_2_from_sext_s32
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: narrow_shl_s64_by_2_from_sext_s32
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX6: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX6: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX6: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
; GFX9-LABEL: name: narrow_shl_s64_by_2_from_sext_s32
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX9: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX9: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX9: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX9: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX9: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
%narrow:_(s32) = COPY $vgpr0
|
|
%masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
%masked:_(s32) = G_AND %narrow, %masklow30
|
|
%extend:_(s64) = G_SEXT %masked
|
|
%shiftamt:_(s32) = G_CONSTANT i32 2
|
|
%shl:_(s64) = G_SHL %extend, %shiftamt
|
|
$vgpr0_vgpr1 = COPY %shl
|
|
...
|
|
|
|
---
|
|
name: narrow_shl_s64_by_2_from_zext_s32_lookthrough_amount
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: narrow_shl_s64_by_2_from_zext_s32_lookthrough_amount
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX6: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX6: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX6: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
; GFX9-LABEL: name: narrow_shl_s64_by_2_from_zext_s32_lookthrough_amount
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: %narrow:_(s32) = COPY $vgpr0
|
|
; GFX9: %masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
; GFX9: %masked:_(s32) = G_AND %narrow, %masklow30
|
|
; GFX9: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s32) = G_SHL %masked, [[C]](s32)
|
|
; GFX9: %shl:_(s64) = G_ZEXT [[SHL]](s32)
|
|
; GFX9: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
%narrow:_(s32) = COPY $vgpr0
|
|
%masklow30:_(s32) = G_CONSTANT i32 1073741823
|
|
%masked:_(s32) = G_AND %narrow, %masklow30
|
|
%extend:_(s64) = G_ZEXT %masked
|
|
%shiftamt64:_(s64) = G_CONSTANT i64 2
|
|
%shiftamt:_(s32) = G_TRUNC %shiftamt64
|
|
%shl:_(s64) = G_SHL %extend, %shiftamt
|
|
$vgpr0_vgpr1 = COPY %shl
|
|
...
|
|
|
|
# Can't introduce a 16-bit shift before gfx8
|
|
---
|
|
name: narrow_shl_s32_by_2_from_zext_s16
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: narrow_shl_s32_by_2_from_zext_s16
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: %argument:_(s32) = COPY $vgpr0
|
|
; GFX6: %narrow:_(s16) = G_TRUNC %argument(s32)
|
|
; GFX6: %masklow14:_(s16) = G_CONSTANT i16 16383
|
|
; GFX6: %masked:_(s16) = G_AND %narrow, %masklow14
|
|
; GFX6: %extend:_(s32) = G_ZEXT %masked(s16)
|
|
; GFX6: %shiftamt:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: %shl:_(s32) = G_SHL %extend, %shiftamt(s32)
|
|
; GFX6: $vgpr0 = COPY %shl(s32)
|
|
; GFX9-LABEL: name: narrow_shl_s32_by_2_from_zext_s16
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: %argument:_(s32) = COPY $vgpr0
|
|
; GFX9: %narrow:_(s16) = G_TRUNC %argument(s32)
|
|
; GFX9: %masklow14:_(s16) = G_CONSTANT i16 16383
|
|
; GFX9: %masked:_(s16) = G_AND %narrow, %masklow14
|
|
; GFX9: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s16) = G_SHL %masked, [[C]](s16)
|
|
; GFX9: %shl:_(s32) = G_ZEXT [[SHL]](s16)
|
|
; GFX9: $vgpr0 = COPY %shl(s32)
|
|
%argument:_(s32) = COPY $vgpr0
|
|
%narrow:_(s16) = G_TRUNC %argument
|
|
%masklow14:_(s16) = G_CONSTANT i16 16383
|
|
%masked:_(s16) = G_AND %narrow, %masklow14
|
|
%extend:_(s32) = G_ZEXT %masked
|
|
%shiftamt:_(s32) = G_CONSTANT i32 2
|
|
%shl:_(s32) = G_SHL %extend, %shiftamt
|
|
$vgpr0 = COPY %shl
|
|
...
|
|
|
|
---
|
|
name: narrow_shl_s64_by_2_from_zext_s16
|
|
tracksRegLiveness: true
|
|
legalized: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $vgpr0
|
|
|
|
; GFX6-LABEL: name: narrow_shl_s64_by_2_from_zext_s16
|
|
; GFX6: liveins: $vgpr0
|
|
; GFX6: %argument:_(s32) = COPY $vgpr0
|
|
; GFX6: %narrow:_(s16) = G_TRUNC %argument(s32)
|
|
; GFX6: %masklow14:_(s16) = G_CONSTANT i16 16383
|
|
; GFX6: %masked:_(s16) = G_AND %narrow, %masklow14
|
|
; GFX6: %extend:_(s64) = G_ZEXT %masked(s16)
|
|
; GFX6: %shiftamt:_(s32) = G_CONSTANT i32 2
|
|
; GFX6: %shl:_(s64) = G_SHL %extend, %shiftamt(s32)
|
|
; GFX6: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
; GFX9-LABEL: name: narrow_shl_s64_by_2_from_zext_s16
|
|
; GFX9: liveins: $vgpr0
|
|
; GFX9: %argument:_(s32) = COPY $vgpr0
|
|
; GFX9: %narrow:_(s16) = G_TRUNC %argument(s32)
|
|
; GFX9: %masklow14:_(s16) = G_CONSTANT i16 16383
|
|
; GFX9: %masked:_(s16) = G_AND %narrow, %masklow14
|
|
; GFX9: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 2
|
|
; GFX9: [[SHL:%[0-9]+]]:_(s16) = G_SHL %masked, [[C]](s16)
|
|
; GFX9: %shl:_(s64) = G_ZEXT [[SHL]](s16)
|
|
; GFX9: $vgpr0_vgpr1 = COPY %shl(s64)
|
|
%argument:_(s32) = COPY $vgpr0
|
|
%narrow:_(s16) = G_TRUNC %argument
|
|
%masklow14:_(s16) = G_CONSTANT i16 16383
|
|
%masked:_(s16) = G_AND %narrow, %masklow14
|
|
%extend:_(s64) = G_ZEXT %masked
|
|
%shiftamt:_(s32) = G_CONSTANT i32 2
|
|
%shl:_(s64) = G_SHL %extend, %shiftamt
|
|
$vgpr0_vgpr1 = COPY %shl
|
|
...
|