Canonicalize header guards into a common format.
[oota-llvm.git] / lib / Target / R600 / SIDefines.h
1 //===-- SIDefines.h - SI Helper Macros ----------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 /// \file
9 //===----------------------------------------------------------------------===//
10
11 #ifndef LLVM_LIB_TARGET_R600_SIDEFINES_H
12 #define LLVM_LIB_TARGET_R600_SIDEFINES_H
13
14 namespace SIInstrFlags {
15 // This needs to be kept in sync with the field bits in InstSI.
16 enum {
17   MIMG = 1 << 3,
18   SMRD = 1 << 4,
19   VOP1 = 1 << 5,
20   VOP2 = 1 << 6,
21   VOP3 = 1 << 7,
22   VOPC = 1 << 8,
23   SALU = 1 << 9,
24   MUBUF = 1 << 10,
25   MTBUF = 1 << 11
26 };
27 }
28
29 #define R_00B028_SPI_SHADER_PGM_RSRC1_PS                                0x00B028
30 #define R_00B02C_SPI_SHADER_PGM_RSRC2_PS                                0x00B02C
31 #define   S_00B02C_EXTRA_LDS_SIZE(x)                                  (((x) & 0xFF) << 8)
32 #define R_00B128_SPI_SHADER_PGM_RSRC1_VS                                0x00B128
33 #define R_00B228_SPI_SHADER_PGM_RSRC1_GS                                0x00B228
34 #define R_00B848_COMPUTE_PGM_RSRC1                                      0x00B848
35 #define   S_00B028_VGPRS(x)                                           (((x) & 0x3F) << 0)
36 #define   S_00B028_SGPRS(x)                                           (((x) & 0x0F) << 6)
37 #define R_00B84C_COMPUTE_PGM_RSRC2                                      0x00B84C
38 #define   S_00B02C_SCRATCH_EN(x)                                      (((x) & 0x1) << 0)
39 #define   S_00B84C_LDS_SIZE(x)                                        (((x) & 0x1FF) << 15)
40 #define R_0286CC_SPI_PS_INPUT_ENA                                       0x0286CC
41
42
43 #define R_00B848_COMPUTE_PGM_RSRC1                                      0x00B848
44 #define   S_00B848_VGPRS(x)                                           (((x) & 0x3F) << 0)
45 #define   G_00B848_VGPRS(x)                                           (((x) >> 0) & 0x3F)
46 #define   C_00B848_VGPRS                                              0xFFFFFFC0
47 #define   S_00B848_SGPRS(x)                                           (((x) & 0x0F) << 6)
48 #define   G_00B848_SGPRS(x)                                           (((x) >> 6) & 0x0F)
49 #define   C_00B848_SGPRS                                              0xFFFFFC3F
50 #define   S_00B848_PRIORITY(x)                                        (((x) & 0x03) << 10)
51 #define   G_00B848_PRIORITY(x)                                        (((x) >> 10) & 0x03)
52 #define   C_00B848_PRIORITY                                           0xFFFFF3FF
53 #define   S_00B848_FLOAT_MODE(x)                                      (((x) & 0xFF) << 12)
54 #define   G_00B848_FLOAT_MODE(x)                                      (((x) >> 12) & 0xFF)
55 #define   C_00B848_FLOAT_MODE                                         0xFFF00FFF
56 #define   S_00B848_PRIV(x)                                            (((x) & 0x1) << 20)
57 #define   G_00B848_PRIV(x)                                            (((x) >> 20) & 0x1)
58 #define   C_00B848_PRIV                                               0xFFEFFFFF
59 #define   S_00B848_DX10_CLAMP(x)                                      (((x) & 0x1) << 21)
60 #define   G_00B848_DX10_CLAMP(x)                                      (((x) >> 21) & 0x1)
61 #define   C_00B848_DX10_CLAMP                                         0xFFDFFFFF
62 #define   S_00B848_DEBUG_MODE(x)                                      (((x) & 0x1) << 22)
63 #define   G_00B848_DEBUG_MODE(x)                                      (((x) >> 22) & 0x1)
64 #define   C_00B848_DEBUG_MODE                                         0xFFBFFFFF
65 #define   S_00B848_IEEE_MODE(x)                                       (((x) & 0x1) << 23)
66 #define   G_00B848_IEEE_MODE(x)                                       (((x) >> 23) & 0x1)
67 #define   C_00B848_IEEE_MODE                                          0xFF7FFFFF
68
69
70 // Helpers for setting FLOAT_MODE
71 #define FP_ROUND_ROUND_TO_NEAREST 0
72 #define FP_ROUND_ROUND_TO_INF 1
73 #define FP_ROUND_ROUND_TO_NEGINF 2
74 #define FP_ROUND_ROUND_TO_ZERO 3
75
76 // Bits 3:0 control rounding mode. 1:0 control single precision, 3:2 double
77 // precision.
78 #define FP_ROUND_MODE_SP(x) ((x) & 0x3)
79 #define FP_ROUND_MODE_DP(x) (((x) & 0x3) << 2)
80
81 #define FP_DENORM_FLUSH_IN_FLUSH_OUT 0
82 #define FP_DENORM_FLUSH_OUT 1
83 #define FP_DENORM_FLUSH_IN 2
84 #define FP_DENORM_FLUSH_NONE 3
85
86
87 // Bits 7:4 control denormal handling. 5:4 control single precision, 6:7 double
88 // precision.
89 #define FP_DENORM_MODE_SP(x) (((x) & 0x3) << 4)
90 #define FP_DENORM_MODE_DP(x) (((x) & 0x3) << 6)
91
92 #define R_00B860_COMPUTE_TMPRING_SIZE                                   0x00B860
93 #define   S_00B860_WAVESIZE(x)                                        (((x) & 0x1FFF) << 12)
94
95 #endif