llvm.org GIT mirror llvm / f18e64f
[AArch64] Move tests from r271677 to a more appropriately named file. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271718 91177308-0d34-0410-b5e6-96231b3b80d8 Chad Rosier 4 years ago
2 changed file(s) with 88 addition(s) and 88 deletion(s). Raw diff Collapse all Expand all
77 %res = add i64 %ext, 1
88 ret i64 %res
99 }
10
11 ; CHECK-LABEL: @test2
12 ; CHECK: sbfx w0, w0, #23, #8
13 define signext i8 @test2(i32 %a) {
14 %tmp = ashr i32 %a, 23
15 %res = trunc i32 %tmp to i8
16 ret i8 %res
17 }
18
19 ; CHECK-LABEL: @test3
20 ; CHECK: sbfx w0, w0, #23, #8
21 define signext i8 @test3(i32 %a) {
22 %tmp = lshr i32 %a, 23
23 %res = trunc i32 %tmp to i8
24 ret i8 %res
25 }
26
27 ; CHECK-LABEL: @test4
28 ; CHECK: sbfx w0, w0, #15, #16
29 define signext i16 @test4(i32 %a) {
30 %tmp = lshr i32 %a, 15
31 %res = trunc i32 %tmp to i16
32 ret i16 %res
33 }
34
35 ; CHECK-LABEL: @test5
36 ; CHECK: sbfx w0, w0, #16, #8
37 define signext i8 @test5(i64 %a) {
38 %tmp = lshr i64 %a, 16
39 %res = trunc i64 %tmp to i8
40 ret i8 %res
41 }
42
43 ; CHECK-LABEL: @test6
44 ; CHECK: sbfx x0, x0, #30, #8
45 define signext i8 @test6(i64 %a) {
46 %tmp = lshr i64 %a, 30
47 %res = trunc i64 %tmp to i8
48 ret i8 %res
49 }
50
51 ; CHECK-LABEL: @test7
52 ; CHECK: sbfx x0, x0, #23, #16
53 define signext i16 @test7(i64 %a) {
54 %tmp = lshr i64 %a, 23
55 %res = trunc i64 %tmp to i16
56 ret i16 %res
57 }
58
59 ; CHECK-LABEL: @test8
60 ; CHECK: asr w0, w0, #25
61 define signext i8 @test8(i32 %a) {
62 %tmp = ashr i32 %a, 25
63 %res = trunc i32 %tmp to i8
64 ret i8 %res
65 }
66
67 ; CHECK-LABEL: @test9
68 ; CHECK: lsr w0, w0, #25
69 define signext i8 @test9(i32 %a) {
70 %tmp = lshr i32 %a, 25
71 %res = trunc i32 %tmp to i8
72 ret i8 %res
73 }
74
75 ; CHECK-LABEL: @test10
76 ; CHECK: lsr x0, x0, #49
77 define signext i16 @test10(i64 %a) {
78 %tmp = lshr i64 %a, 49
79 %res = trunc i64 %tmp to i16
80 ret i16 %res
81 }
82
83 ; SHR with multiple uses is fine as SXTH and SBFX are both aliases of SBFM.
84 ; However, allowing the transformation means the SHR and SBFX can execute in
85 ; parallel.
86 ;
87 ; CHECK-LABEL: @test11
88 ; CHECK: lsr x1, x0, #23
89 ; CHECK: sbfx x0, x0, #23, #16
90 define void @test11(i64 %a) {
91 %tmp = lshr i64 %a, 23
92 %res = trunc i64 %tmp to i16
93 call void @use(i16 %res, i64 %tmp)
94 ret void
95 }
96
97 declare void @use(i16 signext, i64)
462462 %2 = or i64 %1, 157601565442048 ; 0x00008f5679530000
463463 ret i64 %2
464464 }
465
466 ; CHECK-LABEL: @test9
467 ; CHECK: sbfx w0, w0, #23, #8
468 define signext i8 @test9(i32 %a) {
469 %tmp = ashr i32 %a, 23
470 %res = trunc i32 %tmp to i8
471 ret i8 %res
472 }
473
474 ; CHECK-LABEL: @test10
475 ; CHECK: sbfx w0, w0, #23, #8
476 define signext i8 @test10(i32 %a) {
477 %tmp = lshr i32 %a, 23
478 %res = trunc i32 %tmp to i8
479 ret i8 %res
480 }
481
482 ; CHECK-LABEL: @test11
483 ; CHECK: sbfx w0, w0, #15, #16
484 define signext i16 @test11(i32 %a) {
485 %tmp = lshr i32 %a, 15
486 %res = trunc i32 %tmp to i16
487 ret i16 %res
488 }
489
490 ; CHECK-LABEL: @test12
491 ; CHECK: sbfx w0, w0, #16, #8
492 define signext i8 @test12(i64 %a) {
493 %tmp = lshr i64 %a, 16
494 %res = trunc i64 %tmp to i8
495 ret i8 %res
496 }
497
498 ; CHECK-LABEL: @test13
499 ; CHECK: sbfx x0, x0, #30, #8
500 define signext i8 @test13(i64 %a) {
501 %tmp = lshr i64 %a, 30
502 %res = trunc i64 %tmp to i8
503 ret i8 %res
504 }
505
506 ; CHECK-LABEL: @test14
507 ; CHECK: sbfx x0, x0, #23, #16
508 define signext i16 @test14(i64 %a) {
509 %tmp = lshr i64 %a, 23
510 %res = trunc i64 %tmp to i16
511 ret i16 %res
512 }
513
514 ; CHECK-LABEL: @test15
515 ; CHECK: asr w0, w0, #25
516 define signext i8 @test15(i32 %a) {
517 %tmp = ashr i32 %a, 25
518 %res = trunc i32 %tmp to i8
519 ret i8 %res
520 }
521
522 ; CHECK-LABEL: @test16
523 ; CHECK: lsr w0, w0, #25
524 define signext i8 @test16(i32 %a) {
525 %tmp = lshr i32 %a, 25
526 %res = trunc i32 %tmp to i8
527 ret i8 %res
528 }
529
530 ; CHECK-LABEL: @test17
531 ; CHECK: lsr x0, x0, #49
532 define signext i16 @test17(i64 %a) {
533 %tmp = lshr i64 %a, 49
534 %res = trunc i64 %tmp to i16
535 ret i16 %res
536 }
537
538 ; SHR with multiple uses is fine as SXTH and SBFX are both aliases of SBFM.
539 ; However, allowing the transformation means the SHR and SBFX can execute in
540 ; parallel.
541 ;
542 ; CHECK-LABEL: @test18
543 ; CHECK: lsr x1, x0, #23
544 ; CHECK: sbfx x0, x0, #23, #16
545 define void @test18(i64 %a) {
546 %tmp = lshr i64 %a, 23
547 %res = trunc i64 %tmp to i16
548 call void @use(i16 %res, i64 %tmp)
549 ret void
550 }
551
552 declare void @use(i16 signext, i64)