Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 54d67b5

Browse files
committed
[AMDGPU][MC][GFX8+][DISASSEMBLER] Corrected 1/2pi value for 64-bit operands
See bug 39332: https://bugs.llvm.org/show_bug.cgi?id=39332 Reviewers: artem.tamazov, arsenm Differential Revision: https://reviews.llvm.org/D56794 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351555 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9953432 commit 54d67b5

File tree

5 files changed

+29
-22
lines changed

5 files changed

+29
-22
lines changed

docs/AMDGPUOperandSyntax.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -523,22 +523,22 @@ Floating-point *inline constants* are converted to
523523
:ref:`expected operand type<amdgpu_syn_instruction_type>`
524524
as described :ref:`here<amdgpu_synid_fp_const_conv>`.
525525

526-
================================== ===================================================== ==================
527-
Value Note Availability
528-
================================== ===================================================== ==================
529-
0.0 The same as integer constant 0. All GPUs
530-
0.5 Floating-point constant 0.5 All GPUs
531-
1.0 Floating-point constant 1.0 All GPUs
532-
2.0 Floating-point constant 2.0 All GPUs
533-
4.0 Floating-point constant 4.0 All GPUs
534-
-0.5 Floating-point constant -0.5 All GPUs
535-
-1.0 Floating-point constant -1.0 All GPUs
536-
-2.0 Floating-point constant -2.0 All GPUs
537-
-4.0 Floating-point constant -4.0 All GPUs
538-
0.1592 1.0/(2.0*pi). Use only for 16-bit operands. GFX8, GFX9
539-
0.15915494 1.0/(2.0*pi). Use only for 16- and 32-bit operands. GFX8, GFX9
540-
0.159154943091895317852646485335 1.0/(2.0*pi). GFX8, GFX9
541-
================================== ===================================================== ==================
526+
===================== ===================================================== ==================
527+
Value Note Availability
528+
===================== ===================================================== ==================
529+
0.0 The same as integer constant 0. All GPUs
530+
0.5 Floating-point constant 0.5 All GPUs
531+
1.0 Floating-point constant 1.0 All GPUs
532+
2.0 Floating-point constant 2.0 All GPUs
533+
4.0 Floating-point constant 4.0 All GPUs
534+
-0.5 Floating-point constant -0.5 All GPUs
535+
-1.0 Floating-point constant -1.0 All GPUs
536+
-2.0 Floating-point constant -2.0 All GPUs
537+
-4.0 Floating-point constant -4.0 All GPUs
538+
0.1592 1.0/(2.0*pi). Use only for 16-bit operands. GFX8, GFX9
539+
0.15915494 1.0/(2.0*pi). Use only for 16- and 32-bit operands. GFX8, GFX9
540+
0.15915494309189532 1.0/(2.0*pi). GFX8, GFX9
541+
===================== ===================================================== ==================
542542

543543
.. WARNING:: GFX7 does not support inline constants for *f16* operands.
544544

lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ void AMDGPUInstPrinter::printImmediate64(uint64_t Imm,
491491
O << "-4.0";
492492
else if (Imm == 0x3fc45f306dc9c882 &&
493493
STI.getFeatureBits()[AMDGPU::FeatureInv2PiInlineImm])
494-
O << "0.15915494";
494+
O << "0.15915494309189532";
495495
else {
496496
assert(isUInt<32>(Imm) || Imm == 0x3fc45f306dc9c882);
497497

test/CodeGen/AMDGPU/imm.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ define amdgpu_kernel void @add_inline_imm_neg_4.0_f64(double addrspace(1)* %out,
449449
; SI: v_add_f64 v{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}}, v{{\[}}[[LO_VREG]]:[[HI_VREG]]{{\]}}
450450

451451
; VI: s_load_dwordx2 [[VAL:s\[[0-9]+:[0-9]+\]]], {{s\[[0-9]+:[0-9]+\]}}, 0x4c
452-
; VI: v_add_f64 [[REG:v\[[0-9]+:[0-9]+\]]], [[VAL]], 0.15915494{{$}}
452+
; VI: v_add_f64 [[REG:v\[[0-9]+:[0-9]+\]]], [[VAL]], 0.15915494309189532{{$}}
453453
; VI: buffer_store_dwordx2 [[REG]]
454454
define amdgpu_kernel void @add_inline_imm_inv_2pi_f64(double addrspace(1)* %out, [8 x i32], double %x) {
455455
%y = fadd double %x, 0x3fc45f306dc9c882

test/MC/AMDGPU/literals.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ v_and_b32_e32 v0, 0xffffffffffffffff, v1
429429
v_trunc_f32_e32 v0, 0x3fc45f306dc9c882
430430

431431
// NOSICI: error: invalid operand for instruction
432-
// VI: v_fract_f64_e32 v[0:1], 0.15915494 ; encoding: [0xf8,0x64,0x00,0x7e]
432+
// VI: v_fract_f64_e32 v[0:1], 0.15915494309189532 ; encoding: [0xf8,0x64,0x00,0x7e]
433433
v_fract_f64_e32 v[0:1], 0x3fc45f306dc9c882
434434

435435
// SICI: v_trunc_f32_e32 v0, 0x3e22f983 ; encoding: [0xff,0x42,0x00,0x7e,0x83,0xf9,0x22,0x3e]
@@ -445,7 +445,7 @@ v_fract_f64_e32 v[0:1], 0x3e22f983
445445
v_trunc_f32_e64 v0, 0x3fc45f306dc9c882
446446

447447
// NOSICI: error: invalid operand for instruction
448-
// VI: v_fract_f64_e64 v[0:1], 0.15915494 ; encoding: [0x00,0x00,0x72,0xd1,0xf8,0x00,0x00,0x00]
448+
// VI: v_fract_f64_e64 v[0:1], 0.15915494309189532 ; encoding: [0x00,0x00,0x72,0xd1,0xf8,0x00,0x00,0x00]
449449
v_fract_f64_e64 v[0:1], 0x3fc45f306dc9c882
450450

451451
// NOSICI: error: invalid operand for instruction
@@ -457,7 +457,7 @@ v_trunc_f32_e64 v0, 0x3e22f983
457457
v_fract_f64_e64 v[0:1], 0x3e22f983
458458

459459
// NOSICI: error: invalid operand for instruction
460-
// VI: s_mov_b64 s[0:1], 0.15915494 ; encoding: [0xf8,0x01,0x80,0xbe]
460+
// VI: s_mov_b64 s[0:1], 0.15915494309189532 ; encoding: [0xf8,0x01,0x80,0xbe]
461461
s_mov_b64_e32 s[0:1], 0.159154943091895317852646485335
462462

463463
// SICI: v_and_b32_e32 v0, 0x3e22f983, v1 ; encoding: [0xff,0x02,0x00,0x36,0x83,0xf9,0x22,0x3e]
@@ -469,7 +469,7 @@ v_and_b32_e32 v0, 0.159154943091895317852646485335, v1
469469
v_and_b32_e64 v0, 0.159154943091895317852646485335, v1
470470

471471
// SICI: v_fract_f64_e32 v[0:1], 0x3fc45f30 ; encoding: [0xff,0x7c,0x00,0x7e,0x30,0x5f,0xc4,0x3f]
472-
// VI: v_fract_f64_e32 v[0:1], 0.15915494 ; encoding: [0xf8,0x64,0x00,0x7e]
472+
// VI: v_fract_f64_e32 v[0:1], 0.15915494309189532 ; encoding: [0xf8,0x64,0x00,0x7e]
473473
v_fract_f64 v[0:1], 0.159154943091895317852646485335
474474

475475
// SICI: v_trunc_f32_e32 v0, 0x3e22f983 ; encoding: [0xff,0x42,0x00,0x7e,0x83,0xf9,0x22,0x3e]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: llvm-mc -arch=amdgcn -mcpu=tonga -disassemble -show-encoding %s | FileCheck -check-prefix=VI %s
2+
3+
# VI: v_fract_f64_e32 v[0:1], 0.15915494309189532 ; encoding: [0xf8,0x64,0x00,0x7e]
4+
0xf8,0x64,0x00,0x7e
5+
6+
# VI: v_trunc_f32_e32 v0, 0.15915494 ; encoding: [0xf8,0x38,0x00,0x7e]
7+
0xf8,0x38,0x00,0x7e

0 commit comments

Comments
 (0)