2019-09-05 04:46:15 +08:00
|
|
|
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
2019-12-31 01:06:29 +08:00
|
|
|
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s
|
2019-09-05 04:46:15 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_s8
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0
|
|
|
|
; CHECK-LABEL: name: bitreverse_s8
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
|
|
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]]
|
|
|
|
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
|
|
|
|
; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
|
|
|
|
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
|
|
|
|
; CHECK: $vgpr0 = COPY [[COPY2]](s32)
|
|
|
|
%0:_(s32) = COPY $vgpr0
|
|
|
|
%1:_(s8) = G_TRUNC %0
|
|
|
|
%2:_(s8) = G_BITREVERSE %1
|
|
|
|
%3:_(s32) = G_ANYEXT %2
|
|
|
|
$vgpr0 = COPY %3
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_s16
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0
|
|
|
|
; CHECK-LABEL: name: bitreverse_s16
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
|
|
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]]
|
|
|
|
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
|
|
|
|
; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
|
|
|
|
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
|
|
|
|
; CHECK: $vgpr0 = COPY [[COPY2]](s32)
|
|
|
|
%0:_(s32) = COPY $vgpr0
|
|
|
|
%1:_(s16) = G_TRUNC %0
|
|
|
|
%2:_(s16) = G_BITREVERSE %1
|
|
|
|
%3:_(s32) = G_ANYEXT %2
|
|
|
|
$vgpr0 = COPY %3
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_s24
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0
|
|
|
|
; CHECK-LABEL: name: bitreverse_s24
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
|
|
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]]
|
|
|
|
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
|
|
|
|
; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
|
|
|
|
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
|
|
|
|
; CHECK: $vgpr0 = COPY [[COPY2]](s32)
|
|
|
|
%0:_(s32) = COPY $vgpr0
|
|
|
|
%1:_(s24) = G_TRUNC %0
|
|
|
|
%2:_(s24) = G_BITREVERSE %1
|
|
|
|
%3:_(s32) = G_ANYEXT %2
|
|
|
|
$vgpr0 = COPY %3
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_s32
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0
|
|
|
|
; CHECK-LABEL: name: bitreverse_s32
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY]]
|
|
|
|
; CHECK: $vgpr0 = COPY [[BITREVERSE]](s32)
|
|
|
|
%0:_(s32) = COPY $vgpr0
|
|
|
|
%1:_(s32) = G_BITREVERSE %0
|
|
|
|
$vgpr0 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_v2s16
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0
|
|
|
|
; CHECK-LABEL: name: bitreverse_v2s16
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
|
|
|
|
; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
|
|
|
|
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
|
|
|
|
; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
|
|
|
|
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[BITCAST]](s32)
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]]
|
|
|
|
; CHECK: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
|
|
|
|
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
|
|
|
|
; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY2]]
|
|
|
|
; CHECK: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE1]], [[C]](s32)
|
2020-01-05 04:35:26 +08:00
|
|
|
; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
|
|
|
|
; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR1]](s32)
|
|
|
|
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C1]]
|
|
|
|
; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[LSHR2]](s32)
|
|
|
|
; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C1]]
|
|
|
|
; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C]](s32)
|
|
|
|
; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
|
|
|
|
; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
|
|
|
|
; CHECK: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
|
2019-09-05 04:46:15 +08:00
|
|
|
%0:_(<2 x s16>) = COPY $vgpr0
|
|
|
|
%1:_(<2 x s16>) = G_BITREVERSE %0
|
|
|
|
$vgpr0 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_v2s32
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
; CHECK-LABEL: name: bitreverse_v2s32
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
|
|
|
|
; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV]]
|
|
|
|
; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV1]]
|
|
|
|
; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[BITREVERSE]](s32), [[BITREVERSE1]](s32)
|
|
|
|
; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
|
|
|
|
%0:_(<2 x s32>) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(<2 x s32>) = G_BITREVERSE %0
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_s64
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1
|
|
|
|
; CHECK-LABEL: name: bitreverse_s64
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
|
2019-12-31 01:06:29 +08:00
|
|
|
; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV1]]
|
|
|
|
; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV]]
|
|
|
|
; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[BITREVERSE]](s32), [[BITREVERSE1]](s32)
|
|
|
|
; CHECK: $vgpr0_vgpr1 = COPY [[MV]](s64)
|
2019-09-05 04:46:15 +08:00
|
|
|
%0:_(s64) = COPY $vgpr0_vgpr1
|
|
|
|
%1:_(s64) = G_BITREVERSE %0
|
|
|
|
$vgpr0_vgpr1 = COPY %1
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: bitreverse_v2s64
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr0_vgpr1_vgpr2_vgpr3
|
|
|
|
; CHECK-LABEL: name: bitreverse_v2s64
|
|
|
|
; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
|
|
|
|
; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
|
2019-12-31 01:06:29 +08:00
|
|
|
; CHECK: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV]](s64)
|
|
|
|
; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV3]]
|
|
|
|
; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV2]]
|
|
|
|
; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[BITREVERSE]](s32), [[BITREVERSE1]](s32)
|
|
|
|
; CHECK: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV1]](s64)
|
|
|
|
; CHECK: [[BITREVERSE2:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV5]]
|
|
|
|
; CHECK: [[BITREVERSE3:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV4]]
|
|
|
|
; CHECK: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[BITREVERSE2]](s32), [[BITREVERSE3]](s32)
|
|
|
|
; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[MV]](s64), [[MV1]](s64)
|
2019-09-05 04:46:15 +08:00
|
|
|
; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>)
|
|
|
|
%0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
|
|
|
|
%1:_(<2 x s64>) = G_BITREVERSE %0
|
|
|
|
$vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
|
|
|
|
...
|