1 # RUN: llvm-mc -triple mblaze-unknown-unknown -show-encoding %s | FileCheck %s 2 3 # In the microblaze instruction set, any TYPE-B instruction with a 4 # signed immediate value requiring more than 16-bits must be prefixed 5 # with an IMM instruction that contains the high 16-bits. The higher 6 # 16-bits are then combined with the lower 16-bits in the original 7 # instruction to form a 32-bit immediate value. 8 # 9 # The generation of IMM instructions is handled automatically by the 10 # code emitter. Test to ensure that IMM instructions are generated 11 # when they are suppose to and are not generated when they are not 12 # needed. 13 14 # CHECK: addi 15 # BINARY: 001000 00000 00000 0000000000000000 16 # CHECK: encoding: [0x20,0x00,0x00,0x00] 17 addi r0, r0, 0x00000000 18 19 # CHECK: addi 20 # BINARY: 001000 00000 00000 0000000000000001 21 # CHECK: encoding: [0x20,0x00,0x00,0x01] 22 addi r0, r0, 0x00000001 23 24 # CHECK: addi 25 # BINARY: 001000 00000 00000 0000000000000010 26 # CHECK: encoding: [0x20,0x00,0x00,0x02] 27 addi r0, r0, 0x00000002 28 29 # CHECK: addi 30 # BINARY: 001000 00000 00000 0000000000000100 31 # CHECK: encoding: [0x20,0x00,0x00,0x04] 32 addi r0, r0, 0x00000004 33 34 # CHECK: addi 35 # BINARY: 001000 00000 00000 0000000000001000 36 # CHECK: encoding: [0x20,0x00,0x00,0x08] 37 addi r0, r0, 0x00000008 38 39 # CHECK: addi 40 # BINARY: 001000 00000 00000 0000000000010000 41 # CHECK: encoding: [0x20,0x00,0x00,0x10] 42 addi r0, r0, 0x00000010 43 44 # CHECK: addi 45 # BINARY: 001000 00000 00000 0000000000100000 46 # CHECK: encoding: [0x20,0x00,0x00,0x20] 47 addi r0, r0, 0x00000020 48 49 # CHECK: addi 50 # BINARY: 001000 00000 00000 0000000001000000 51 # CHECK: encoding: [0x20,0x00,0x00,0x40] 52 addi r0, r0, 0x00000040 53 54 # CHECK: addi 55 # BINARY: 001000 00000 00000 0000000010000000 56 # CHECK: encoding: [0x20,0x00,0x00,0x80] 57 addi r0, r0, 0x00000080 58 59 # CHECK: addi 60 # BINARY: 001000 00000 00000 0000000100000000 61 # CHECK: encoding: [0x20,0x00,0x01,0x00] 62 addi r0, r0, 0x00000100 63 64 # CHECK: addi 65 # BINARY: 001000 00000 00000 0000001000000000 66 # CHECK: encoding: [0x20,0x00,0x02,0x00] 67 addi r0, r0, 0x00000200 68 69 # CHECK: addi 70 # BINARY: 001000 00000 00000 0000010000000000 71 # CHECK: encoding: [0x20,0x00,0x04,0x00] 72 addi r0, r0, 0x00000400 73 74 # CHECK: addi 75 # BINARY: 001000 00000 00000 0000100000000000 76 # CHECK: encoding: [0x20,0x00,0x08,0x00] 77 addi r0, r0, 0x00000800 78 79 # CHECK: addi 80 # BINARY: 001000 00000 00000 0001000000000000 81 # CHECK: encoding: [0x20,0x00,0x10,0x00] 82 addi r0, r0, 0x00001000 83 84 # CHECK: addi 85 # BINARY: 001000 00000 00000 0010000000000000 86 # CHECK: encoding: [0x20,0x00,0x20,0x00] 87 addi r0, r0, 0x00002000 88 89 # CHECK: addi 90 # BINARY: 001000 00000 00000 0100000000000000 91 # CHECK: encoding: [0x20,0x00,0x40,0x00] 92 addi r0, r0, 0x00004000 93 94 # CHECK: addi 95 # BINARY: 101100 00000 00000 0000000000000000 96 # BINARY: 001000 00000 00000 1000000000000000 97 # CHECK: encoding: [0xb0,0x00,0x00,0x00,0x20,0x00,0x80,0x00] 98 addi r0, r0, 0x00008000 99 100 # CHECK: addi 101 # BINARY: 101100 00000 00000 0000000000000001 102 # 001000 00000 00000 0000000000000000 103 # CHECK: encoding: [0xb0,0x00,0x00,0x01,0x20,0x00,0x00,0x00] 104 addi r0, r0, 0x00010000 105 106 # CHECK: addi 107 # BINARY: 101100 00000 00000 0000000000000010 108 # 001000 00000 00000 0000000000000000 109 # CHECK: encoding: [0xb0,0x00,0x00,0x02,0x20,0x00,0x00,0x00] 110 addi r0, r0, 0x00020000 111 112 # CHECK: addi 113 # BINARY: 101100 00000 00000 0000000000000100 114 # 001000 00000 00000 0000000000000000 115 # CHECK: encoding: [0xb0,0x00,0x00,0x04,0x20,0x00,0x00,0x00] 116 addi r0, r0, 0x00040000 117 118 # CHECK: addi 119 # BINARY: 101100 00000 00000 0000000000001000 120 # 001000 00000 00000 0000000000000000 121 # CHECK: encoding: [0xb0,0x00,0x00,0x08,0x20,0x00,0x00,0x00] 122 addi r0, r0, 0x00080000 123 124 # CHECK: addi 125 # BINARY: 101100 00000 00000 0000000000010000 126 # 001000 00000 00000 0000000000000000 127 # CHECK: encoding: [0xb0,0x00,0x00,0x10,0x20,0x00,0x00,0x00] 128 addi r0, r0, 0x00100000 129 130 # CHECK: addi 131 # BINARY: 101100 00000 00000 0000000000100000 132 # 001000 00000 00000 0000000000000000 133 # CHECK: encoding: [0xb0,0x00,0x00,0x20,0x20,0x00,0x00,0x00] 134 addi r0, r0, 0x00200000 135 136 # CHECK: addi 137 # BINARY: 101100 00000 00000 0000000001000000 138 # 001000 00000 00000 0000000000000000 139 # CHECK: encoding: [0xb0,0x00,0x00,0x40,0x20,0x00,0x00,0x00] 140 addi r0, r0, 0x00400000 141 142 # CHECK: addi 143 # BINARY: 101100 00000 00000 0000000010000000 144 # 001000 00000 00000 0000000000000000 145 # CHECK: encoding: [0xb0,0x00,0x00,0x80,0x20,0x00,0x00,0x00] 146 addi r0, r0, 0x00800000 147 148 # CHECK: addi 149 # BINARY: 101100 00000 00000 0000000100000000 150 # 001000 00000 00000 0000000000000000 151 # CHECK: encoding: [0xb0,0x00,0x01,0x00,0x20,0x00,0x00,0x00] 152 addi r0, r0, 0x01000000 153 154 # CHECK: addi 155 # BINARY: 101100 00000 00000 0000001000000000 156 # 001000 00000 00000 0000000000000000 157 # CHECK: encoding: [0xb0,0x00,0x02,0x00,0x20,0x00,0x00,0x00] 158 addi r0, r0, 0x02000000 159 160 # CHECK: addi 161 # BINARY: 101100 00000 00000 0000010000000000 162 # 001000 00000 00000 0000000000000000 163 # CHECK: encoding: [0xb0,0x00,0x04,0x00,0x20,0x00,0x00,0x00] 164 addi r0, r0, 0x04000000 165 166 # CHECK: addi 167 # BINARY: 101100 00000 00000 0000100000000000 168 # 001000 00000 00000 0000000000000000 169 # CHECK: encoding: [0xb0,0x00,0x08,0x00,0x20,0x00,0x00,0x00] 170 addi r0, r0, 0x08000000 171 172 # CHECK: addi 173 # BINARY: 101100 00000 00000 0001000000000000 174 # 001000 00000 00000 0000000000000000 175 # CHECK: encoding: [0xb0,0x00,0x10,0x00,0x20,0x00,0x00,0x00] 176 addi r0, r0, 0x10000000 177 178 # CHECK: addi 179 # BINARY: 101100 00000 00000 0010000000000000 180 # 001000 00000 00000 0000000000000000 181 # CHECK: encoding: [0xb0,0x00,0x20,0x00,0x20,0x00,0x00,0x00] 182 addi r0, r0, 0x20000000 183 184 # CHECK: addi 185 # BINARY: 101100 00000 00000 0100000000000000 186 # 001000 00000 00000 0000000000000000 187 # CHECK: encoding: [0xb0,0x00,0x40,0x00,0x20,0x00,0x00,0x00] 188 addi r0, r0, 0x40000000 189 190 # CHECK: addi 191 # BINARY: 101100 00000 00000 1000000000000000 192 # 001000 00000 00000 0000000000000000 193 # CHECK: encoding: [0xb0,0x00,0x80,0x00,0x20,0x00,0x00,0x00] 194 addi r0, r0, 0x80000000 195