Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AMDGPU/GlobalISel: Form CVT_F32_UBYTE0
- Loading branch information
Showing
6 changed files
with
237 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple=amdgcn-amd-amdhsa -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s | ||
|
||
--- | ||
name: uitofp_char_to_f32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: uitofp_char_to_f32 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[AMDGPU_CVT_F32_UBYTE0_:%[0-9]+]]:_(s32) = G_AMDGPU_CVT_F32_UBYTE0 [[AND]] | ||
; CHECK: $vgpr0 = COPY [[AMDGPU_CVT_F32_UBYTE0_]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 255 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s32) = G_UITOFP %2 | ||
$vgpr0 = COPY %3 | ||
... | ||
|
||
--- | ||
name: uitofp_too_many_bits_to_f32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: uitofp_too_many_bits_to_f32 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 256 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32) | ||
; CHECK: $vgpr0 = COPY [[UITOFP]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 256 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s32) = G_UITOFP %2 | ||
$vgpr0 = COPY %3 | ||
... | ||
|
||
--- | ||
name: sitofp_char_to_f32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: sitofp_char_to_f32 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[AMDGPU_CVT_F32_UBYTE0_:%[0-9]+]]:_(s32) = G_AMDGPU_CVT_F32_UBYTE0 [[AND]] | ||
; CHECK: $vgpr0 = COPY [[AMDGPU_CVT_F32_UBYTE0_]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 255 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s32) = G_SITOFP %2 | ||
$vgpr0 = COPY %3 | ||
... | ||
|
||
--- | ||
name: sitofp_bits127_to_f32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: sitofp_bits127_to_f32 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[AMDGPU_CVT_F32_UBYTE0_:%[0-9]+]]:_(s32) = G_AMDGPU_CVT_F32_UBYTE0 [[AND]] | ||
; CHECK: $vgpr0 = COPY [[AMDGPU_CVT_F32_UBYTE0_]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 127 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s32) = G_SITOFP %2 | ||
$vgpr0 = COPY %3 | ||
... | ||
|
||
--- | ||
name: sitofp_bits128_to_f32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: sitofp_bits128_to_f32 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 128 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[AMDGPU_CVT_F32_UBYTE0_:%[0-9]+]]:_(s32) = G_AMDGPU_CVT_F32_UBYTE0 [[AND]] | ||
; CHECK: $vgpr0 = COPY [[AMDGPU_CVT_F32_UBYTE0_]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 128 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s32) = G_SITOFP %2 | ||
$vgpr0 = COPY %3 | ||
... | ||
--- | ||
name: sitofp_too_many_bits_to_f32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: sitofp_too_many_bits_to_f32 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 256 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[AND]](s32) | ||
; CHECK: $vgpr0 = COPY [[SITOFP]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 256 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s32) = G_SITOFP %2 | ||
$vgpr0 = COPY %3 | ||
... | ||
|
||
--- | ||
name: uitofp_char_to_f16 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: uitofp_char_to_f16 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[AMDGPU_CVT_F32_UBYTE0_:%[0-9]+]]:_(s32) = G_AMDGPU_CVT_F32_UBYTE0 [[AND]] | ||
; CHECK: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[AMDGPU_CVT_F32_UBYTE0_]](s32) | ||
; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[FPTRUNC]](s16) | ||
; CHECK: $vgpr0 = COPY [[ANYEXT]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 255 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s16) = G_UITOFP %2 | ||
%4:_(s32) = G_ANYEXT %3 | ||
$vgpr0 = COPY %4 | ||
... | ||
|
||
--- | ||
name: sitofp_char_to_f16 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $vgpr0 | ||
; CHECK-LABEL: name: sitofp_char_to_f16 | ||
; CHECK: liveins: $vgpr0 | ||
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 | ||
; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 | ||
; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] | ||
; CHECK: [[AMDGPU_CVT_F32_UBYTE0_:%[0-9]+]]:_(s32) = G_AMDGPU_CVT_F32_UBYTE0 [[AND]] | ||
; CHECK: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[AMDGPU_CVT_F32_UBYTE0_]](s32) | ||
; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[FPTRUNC]](s16) | ||
; CHECK: $vgpr0 = COPY [[ANYEXT]](s32) | ||
%0:_(s32) = COPY $vgpr0 | ||
%1:_(s32) = G_CONSTANT i32 255 | ||
%2:_(s32) = G_AND %0, %1 | ||
%3:_(s16) = G_SITOFP %2 | ||
%4:_(s32) = G_ANYEXT %3 | ||
$vgpr0 = COPY %4 | ||
... |