OLD | NEW |
1 ; This tries to be a comprehensive test of i8 operations. | 1 ; This tries to be a comprehensive test of i8 operations. |
2 | 2 |
3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s | 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s |
4 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s | 4 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s |
5 | 5 |
6 declare void @useInt(i32 %x) | 6 declare void @useInt(i32 %x) |
7 | 7 |
8 define internal i32 @add8Bit(i32 %a, i32 %b) { | 8 define internal i32 @add8Bit(i32 %a, i32 %b) { |
9 entry: | 9 entry: |
10 %a_8 = trunc i32 %a to i8 | 10 %a_8 = trunc i32 %a to i8 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 ; CHECK-DAG: mov {{.*}},{{[a-d]}}l | 328 ; CHECK-DAG: mov {{.*}},{{[a-d]}}l |
329 ; CHECK-DAG: mov {{.*}},BYTE PTR | 329 ; CHECK-DAG: mov {{.*}},BYTE PTR |
330 ; CHECK-DAG: mov BYTE PTR {{.*}} | 330 ; CHECK-DAG: mov BYTE PTR {{.*}} |
331 | 331 |
332 @global8 = internal global [1 x i8] c"\01", align 4 | 332 @global8 = internal global [1 x i8] c"\01", align 4 |
333 | 333 |
334 define i32 @load_i8(i32 %addr_arg) { | 334 define i32 @load_i8(i32 %addr_arg) { |
335 entry: | 335 entry: |
336 %addr = inttoptr i32 %addr_arg to i8* | 336 %addr = inttoptr i32 %addr_arg to i8* |
337 %ret = load i8* %addr, align 1 | 337 %ret = load i8* %addr, align 1 |
338 %ret_ext = zext i8 %ret to i32 | 338 %ret2 = sub i8 %ret, 0 |
| 339 %ret_ext = zext i8 %ret2 to i32 |
339 ret i32 %ret_ext | 340 ret i32 %ret_ext |
340 } | 341 } |
341 ; CHECK-LABEL: load_i8 | 342 ; CHECK-LABEL: load_i8 |
342 ; CHECK: mov {{[a-d]l}},BYTE PTR | 343 ; CHECK: mov {{[a-d]l}},BYTE PTR |
343 | 344 |
344 define i32 @load_i8_global(i32 %addr_arg) { | 345 define i32 @load_i8_global(i32 %addr_arg) { |
345 entry: | 346 entry: |
346 %addr = bitcast [1 x i8]* @global8 to i8* | 347 %addr = bitcast [1 x i8]* @global8 to i8* |
347 %ret = load i8* %addr, align 1 | 348 %ret = load i8* %addr, align 1 |
348 %ret_ext = zext i8 %ret to i32 | 349 %ret2 = sub i8 %ret, 0 |
| 350 %ret_ext = zext i8 %ret2 to i32 |
349 ret i32 %ret_ext | 351 ret i32 %ret_ext |
350 } | 352 } |
351 ; CHECK-LABEL: load_i8_global | 353 ; CHECK-LABEL: load_i8_global |
352 ; CHECK: mov {{[a-d]l}},BYTE PTR | 354 ; CHECK: mov {{[a-d]l}},BYTE PTR |
353 | 355 |
354 define void @store_i8(i32 %addr_arg, i32 %val) { | 356 define void @store_i8(i32 %addr_arg, i32 %val) { |
355 entry: | 357 entry: |
356 %val_trunc = trunc i32 %val to i8 | 358 %val_trunc = trunc i32 %val to i8 |
357 %addr = inttoptr i32 %addr_arg to i8* | 359 %addr = inttoptr i32 %addr_arg to i8* |
358 store i8 %val_trunc, i8* %addr, align 1 | 360 store i8 %val_trunc, i8* %addr, align 1 |
359 ret void | 361 ret void |
360 } | 362 } |
361 ; CHECK-LABEL: store_i8 | 363 ; CHECK-LABEL: store_i8 |
362 ; CHECK: mov BYTE PTR {{.*}},{{[a-d]l}} | 364 ; CHECK: mov BYTE PTR {{.*}},{{[a-d]l}} |
363 | 365 |
364 define void @store_i8_const(i32 %addr_arg) { | 366 define void @store_i8_const(i32 %addr_arg) { |
365 entry: | 367 entry: |
366 %addr = inttoptr i32 %addr_arg to i8* | 368 %addr = inttoptr i32 %addr_arg to i8* |
367 store i8 123, i8* %addr, align 1 | 369 store i8 123, i8* %addr, align 1 |
368 ret void | 370 ret void |
369 } | 371 } |
370 ; CHECK-LABEL: store_i8_const | 372 ; CHECK-LABEL: store_i8_const |
371 ; CHECK: mov BYTE PTR {{.*}},0x7b | 373 ; CHECK: mov BYTE PTR {{.*}},0x7b |
OLD | NEW |