forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMDGPU] Disable inline constants for pseudo scalar transcendentals (l…
…lvm#104395) Prevent operand folding from inlining constants into pseudo scalar transcendental f16 instructions. However still allow literal constants. (cherry picked from commit fc6300a) Change-Id: I5cd412741939cc812150dbb24bd2735a64573b70
- Loading branch information
Showing
4 changed files
with
138 additions
and
0 deletions.
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
120 changes: 120 additions & 0 deletions
120
llvm/test/CodeGen/AMDGPU/pseudo-scalar-transcendental.mir
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,120 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
# RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -run-pass=si-fold-operands -verify-machineinstrs -o - %s | FileCheck --check-prefix=GCN %s | ||
|
||
# Do not use inline constants for f16 pseudo scalar transcendentals. | ||
# But allow literal constants. | ||
|
||
--- | ||
name: exp_f16_imm | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: exp_f16_imm | ||
; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 | ||
; GCN-NEXT: [[V_S_EXP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_EXP_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 15360 | ||
%1:sgpr_32 = V_S_EXP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: exp_f16_literal | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: exp_f16_literal | ||
; GCN: [[V_S_EXP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_EXP_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 16960 | ||
%1:sgpr_32 = V_S_EXP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: log_f16_imm | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: log_f16_imm | ||
; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 | ||
; GCN-NEXT: [[V_S_LOG_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_LOG_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 15360 | ||
%1:sgpr_32 = V_S_LOG_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: log_f16_literal | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: log_f16_literal | ||
; GCN: [[V_S_LOG_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_LOG_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 16960 | ||
%1:sgpr_32 = V_S_LOG_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: rcp_f16_imm | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: rcp_f16_imm | ||
; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 | ||
; GCN-NEXT: [[V_S_RCP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RCP_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 15360 | ||
%1:sgpr_32 = V_S_RCP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: rcp_f16_literal | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: rcp_f16_literal | ||
; GCN: [[V_S_RCP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RCP_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 16960 | ||
%1:sgpr_32 = V_S_RCP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: rsq_f16_imm | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: rsq_f16_imm | ||
; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 | ||
; GCN-NEXT: [[V_S_RSQ_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RSQ_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 15360 | ||
%1:sgpr_32 = V_S_RSQ_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: rsq_f16_literal | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: rsq_f16_literal | ||
; GCN: [[V_S_RSQ_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RSQ_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 16960 | ||
%1:sgpr_32 = V_S_RSQ_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: sqrt_f16_imm | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: sqrt_f16_imm | ||
; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 | ||
; GCN-NEXT: [[V_S_SQRT_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_SQRT_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 15360 | ||
%1:sgpr_32 = V_S_SQRT_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... | ||
|
||
--- | ||
name: sqrt_f16_literal | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: sqrt_f16_literal | ||
; GCN: [[V_S_SQRT_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_SQRT_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec | ||
%0:sgpr_32 = S_MOV_B32 16960 | ||
%1:sgpr_32 = V_S_SQRT_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
... |