mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
3bb0a6b076
Convert the operand to int if possible, i.e. if the value is properly initialized. (I suppose there is further room for improvement here to also peform the shift if the uninitialized bits are shifted out.) With this little change we can now compute the scaling factor for compressed displacement with pure tablegen code in the X86 backend. This is useful because both the X86-disassembler-specific part of tablegen and the assembler need this and TD is the natural sharing place. The patch also adds the missing documentation for the shift and add operator. llvm-svn: 213277
30 lines
539 B
TableGen
30 lines
539 B
TableGen
// RUN: llvm-tblgen %s | FileCheck %s
|
|
// XFAIL: vg_leak
|
|
|
|
def shifts {
|
|
bits<2> b = 0b10;
|
|
int i = 2;
|
|
int shifted_b = !shl(b, 2);
|
|
int shifted_i = !shl(i, 2);
|
|
}
|
|
// CHECK: def shifts
|
|
// CHECK: shifted_b = 8
|
|
// CHECK: shifted_i = 8
|
|
|
|
class Int<int value> {
|
|
int Value = value;
|
|
}
|
|
|
|
def v1024 : Int<1024>;
|
|
// CHECK: def v1024
|
|
// CHECK: Value = 1024
|
|
|
|
def v1025 : Int<!add(v1024.Value, 1)>;
|
|
// CHECK: def v1025
|
|
// CHECK: Value = 1025
|
|
|
|
def v2048 : Int<!add(v1024.Value, v1024.Value)>;
|
|
// CHECK: def v2048
|
|
// CHECK: Value = 2048
|
|
|