Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 1 | From f846bd900d5277dd9defb5fe0625f97e3417ee61 Mon Sep 17 00:00:00 2001 |
| 2 | From: Mahesh Bodapati <mbodapat@xilinx.com> |
| 3 | Date: Tue, 17 Jan 2017 17:04:37 +0530 |
| 4 | Subject: [PATCH 21/54] [Patch, microblaze]: Add cbranchsi4_reg This patch |
| 5 | optimizes the generation of pcmpne/pcmpeq instruction if the compare |
| 6 | instruction has no immediate values.For the immediate values the xor |
| 7 | instruction is generated |
| 8 | |
| 9 | Signed-off-by: Nagaraju Mekala <nmekala@xilix.com> |
| 10 | Signed-off-by: Ajit Agarwal <ajitkum@xilinx.com> |
| 11 | |
| 12 | ChangeLog: |
| 13 | 2015-01-13 Nagaraju Mekala <nmekala@xilix.com> |
| 14 | Ajit Agarwal <ajitkum@xilinx.com> |
| 15 | |
| 16 | *microblaze.md (cbranchsi4_reg): New |
| 17 | *microblaze.c (microblaze_expand_conditional_branch_reg): New |
| 18 | |
| 19 | Conflicts: |
| 20 | |
| 21 | gcc/config/microblaze/microblaze-protos.h |
| 22 | --- |
| 23 | gcc/config/microblaze/microblaze-protos.h | 2 +- |
| 24 | gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c | 2 +- |
| 25 | gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c | 2 +- |
| 26 | gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c | 2 +- |
| 27 | gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c | 2 +- |
| 28 | gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c | 14 +++++++------- |
| 29 | gcc/testsuite/gcc.target/microblaze/isa/vanilla.c | 12 ++++++------ |
| 30 | gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c | 2 +- |
| 31 | 8 files changed, 19 insertions(+), 19 deletions(-) |
| 32 | |
| 33 | diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h |
| 34 | index f8a56f7..c39e2e9 100644 |
| 35 | --- a/gcc/config/microblaze/microblaze-protos.h |
| 36 | +++ b/gcc/config/microblaze/microblaze-protos.h |
| 37 | @@ -32,7 +32,7 @@ extern int microblaze_expand_shift (rtx *); |
| 38 | extern bool microblaze_expand_move (machine_mode, rtx *); |
| 39 | extern bool microblaze_expand_block_move (rtx, rtx, rtx, rtx); |
| 40 | extern void microblaze_expand_divide (rtx *); |
| 41 | -extern void microblaze_expand_conditional_branch (machine_mode, rtx *); |
| 42 | +extern void microblaze_expand_conditional_branch (enum machine_mode, rtx *); |
| 43 | extern void microblaze_expand_conditional_branch_reg (machine_mode, rtx *); |
| 44 | extern void microblaze_expand_conditional_branch_sf (rtx *); |
| 45 | extern int microblaze_can_use_return_insn (void); |
| 46 | diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c |
| 47 | index 4041a24..ccc6a46 100644 |
| 48 | --- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c |
| 49 | +++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c |
| 50 | @@ -6,5 +6,5 @@ void float_func () |
| 51 | { |
| 52 | /* { dg-final { scan-assembler "fcmp\.(le|gt)\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ |
| 53 | if (f2 <= f3) |
| 54 | - print ("le"); |
| 55 | + f2 = f3; |
| 56 | } |
| 57 | diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c |
| 58 | index 3902b83..1dd5fe6 100644 |
| 59 | --- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c |
| 60 | +++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c |
| 61 | @@ -6,5 +6,5 @@ void float_func () |
| 62 | { |
| 63 | /* { dg-final { scan-assembler "fcmp\.(lt|ge)\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ |
| 64 | if (f2 < f3) |
| 65 | - print ("lt"); |
| 66 | + f2 = f3; |
| 67 | } |
| 68 | diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c |
| 69 | index 8555974..d6f80fb 100644 |
| 70 | --- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c |
| 71 | +++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c |
| 72 | @@ -6,5 +6,5 @@ void float_func () |
| 73 | { |
| 74 | /* { dg-final { scan-assembler "fcmp\.(eq|ne)\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ |
| 75 | if (f2 == f3) |
| 76 | - print ("eq"); |
| 77 | + f1 = f2 + f3; |
| 78 | } |
| 79 | diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c |
| 80 | index 79cc5f9..d117724 100644 |
| 81 | --- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c |
| 82 | +++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c |
| 83 | @@ -5,5 +5,5 @@ void float_func(float f1, float f2, float f3) |
| 84 | /* { dg-final { scan-assembler "fcmp\.eq\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ |
| 85 | /* { dg-final { scan-assembler "fcmp\.le\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ |
| 86 | if(f1==f2 && f1<=f3) |
| 87 | - print ("f1 eq f2 && f1 le f3"); |
| 88 | + f2 = f3; |
| 89 | } |
| 90 | diff --git a/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c b/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c |
| 91 | index ebfb170..7582297 100644 |
| 92 | --- a/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c |
| 93 | +++ b/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c |
| 94 | @@ -5,17 +5,17 @@ volatile float f1, f2, f3; |
| 95 | void float_func () |
| 96 | { |
| 97 | /* { dg-final { scan-assembler-not "fcmp" } } */ |
| 98 | - if (f2 <= f3) |
| 99 | - print ("le"); |
| 100 | + if (f2 <= f3) |
| 101 | + f1 = f3; |
| 102 | else if (f2 == f3) |
| 103 | - print ("eq"); |
| 104 | + f1 = f3; |
| 105 | else if (f2 < f3) |
| 106 | - print ("lt"); |
| 107 | + f1 = f3; |
| 108 | else if (f2 > f3) |
| 109 | - print ("gt"); |
| 110 | + f1 = f3; |
| 111 | else if (f2 >= f3) |
| 112 | - print ("ge"); |
| 113 | + f1 = f3; |
| 114 | else if (f2 != f3) |
| 115 | - print ("ne"); |
| 116 | + f1 = f3; |
| 117 | |
| 118 | } |
| 119 | diff --git a/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c b/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c |
| 120 | index 1d6ba80..532c035 100644 |
| 121 | --- a/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c |
| 122 | +++ b/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c |
| 123 | @@ -74,16 +74,16 @@ void float_cmp_func () |
| 124 | { |
| 125 | /* { dg-final { scan-assembler-not "fcmp" } } */ |
| 126 | if (f2 <= f3) |
| 127 | - print ("le"); |
| 128 | + f1 = f3; |
| 129 | else if (f2 == f3) |
| 130 | - print ("eq"); |
| 131 | + f1 = f3; |
| 132 | else if (f2 < f3) |
| 133 | - print ("lt"); |
| 134 | + f1 = f3; |
| 135 | else if (f2 > f3) |
| 136 | - print ("gt"); |
| 137 | + f1 = f3; |
| 138 | else if (f2 >= f3) |
| 139 | - print ("ge"); |
| 140 | + f1 = f3; |
| 141 | else if (f2 != f3) |
| 142 | - print ("ne"); |
| 143 | + f1 = f3; |
| 144 | |
| 145 | } |
| 146 | diff --git a/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c b/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c |
| 147 | index fdcde1f..580b4db 100644 |
| 148 | --- a/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c |
| 149 | +++ b/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c |
| 150 | @@ -5,4 +5,4 @@ void trap () |
| 151 | __builtin_trap (); |
| 152 | } |
| 153 | |
| 154 | -/* { dg-final { scan-assembler "brki\tr0,-1" } } */ |
| 155 | \ No newline at end of file |
| 156 | +/* { dg-final { scan-assembler "bri\t0" } } */ |
| 157 | -- |
| 158 | 2.7.4 |
| 159 | |