PowerPC conditional branch test

Message ID 20190405015008.GH8657@bubble.grove.modra.org
State New
Headers show
Series
  • PowerPC conditional branch test
Related show

Commit Message

Alan Modra April 5, 2019, 1:50 a.m.
Adds a new test checking conditional branch BO values.

	* testsuite/gas/ppc/bc.s,
	* testsuite/gas/ppc/bcat.d,
	* testsuite/gas/ppc/bcaterr.d,
	* testsuite/gas/ppc/bcaterr.l,
	* testsuite/gas/ppc/bcy.d,
	* testsuite/gas/ppc/bcyerr.d,
	* testsuite/gas/ppc/bcyerr.l: New tests.
	* testsuite/gas/ppc/ppc.exp: Run them.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/gas/testsuite/gas/ppc/bc.s b/gas/testsuite/gas/ppc/bc.s
new file mode 100644
index 0000000000..245945568e
--- /dev/null
+++ b/gas/testsuite/gas/ppc/bc.s
@@ -0,0 +1,154 @@ 
+ .macro err op:vararg
+  .ifndef AT
+   .ifndef Y
+    \op
+   .endif
+  .endif
+ .endm
+
+ .macro errat op:vararg
+  .ifndef AT
+   \op
+  .endif
+ .endm
+
+ .macro erry op:vararg
+  .ifndef Y
+   \op
+  .endif
+ .endm
+
+ .text
+	bc 0,0,.
+ errat	bc 1,0,.	# z bit
+	bc 2,0,.
+ errat	bc 3,0,.	# z bit
+	bc 4,0,.
+ errat	bc 5,0,.	# at = 01 reserved
+ erry	bc 6,0,.	# z bit
+ erry	bc 7,0,.	# z bit
+	bc 8,0,.
+ errat	bc 9,0,.	# z bit
+	bc 10,0,.
+ errat	bc 11,0,.	# z bit
+	bc 12,0,.
+ errat	bc 13,0,.	# at = 01 reserved
+ erry	bc 14,0,.	# z bit
+ erry	bc 15,0,.	# z bit
+	bc 16,0,.
+ errat	bc 17,0,.	# at = 01 reserved
+	bc 18,0,.
+ errat	bc 19,0,.	# at = 01 reserved
+	bc 20,0,.
+ err	bc 21,0,.	# z bit
+ err	bc 22,0,.	# z bit
+ err	bc 23,0,.	# z bit
+ erry	bc 24,0,.	# z bit
+ erry	bc 25,0,.	# z bit
+ erry	bc 26,0,.	# z bit
+ erry	bc 27,0,.	# z bit
+ err	bc 28,0,.	# z bit
+ err	bc 29,0,.	# z bit
+ err	bc 30,0,.	# z bit
+ err	bc 31,0,.	# z bit
+
+ err	bcctr 0,0
+ err	bcctr 1,0
+ err	bcctr 2,0
+ err	bcctr 3,0
+	bcctr 4,0
+ errat	bcctr 5,0
+ erry	bcctr 6,0
+ erry	bcctr 7,0
+ err	bcctr 8,0
+ err	bcctr 9,0
+ err	bcctr 10,0
+ err	bcctr 11,0
+	bcctr 12,0
+ errat	bcctr 13,0
+ erry	bcctr 14,0
+ erry	bcctr 15,0
+ err	bcctr 16,0
+ err	bcctr 17,0
+ err	bcctr 18,0
+ err	bcctr 19,0
+	bcctr 20,0
+ err	bcctr 21,0
+ err	bcctr 22,0
+ err	bcctr 23,0
+ err	bcctr 24,0
+ err	bcctr 25,0
+ err	bcctr 26,0
+ err	bcctr 27,0
+ err	bcctr 28,0
+ err	bcctr 29,0
+ err	bcctr 30,0
+ err	bcctr 31,0
+
+	bclr 0,0
+ errat	bclr 1,0
+	bclr 2,0
+ errat	bclr 3,0
+	bclr 4,0
+ errat	bclr 5,0
+ erry	bclr 6,0
+ erry	bclr 7,0
+	bclr 8,0
+ errat	bclr 9,0
+	bclr 10,0
+ errat	bclr 11,0
+	bclr 12,0
+ errat	bclr 13,0
+ erry	bclr 14,0
+ erry	bclr 15,0
+	bclr 16,0
+ errat	bclr 17,0
+	bclr 18,0
+ errat	bclr 19,0
+	bclr 20,0
+ err	bclr 21,0
+ err	bclr 22,0
+ err	bclr 23,0
+ erry	bclr 24,0
+ erry	bclr 25,0
+ erry	bclr 26,0
+ erry	bclr 27,0
+ err	bclr 28,0
+ err	bclr 29,0
+ err	bclr 30,0
+ err	bclr 31,0
+
+ .ifdef POWER8
+	bctar 0,0
+ errat	bctar 1,0
+	bctar 2,0
+ errat	bctar 3,0
+	bctar 4,0
+ errat	bctar 5,0
+	bctar 6,0
+	bctar 7,0
+	bctar 8,0
+ errat	bctar 9,0
+	bctar 10,0
+ errat	bctar 11,0
+	bctar 12,0
+ errat	bctar 13,0
+	bctar 14,0
+	bctar 15,0
+	bctar 16,0
+ errat	bctar 17,0
+	bctar 18,0
+ errat	bctar 19,0
+	bctar 20,0
+ errat	bctar 21,0
+ errat	bctar 22,0
+ errat	bctar 23,0
+	bctar 24,0
+	bctar 25,0
+	bctar 26,0
+	bctar 27,0
+ errat	bctar 28,0
+ errat	bctar 29,0
+ errat	bctar 30,0
+ errat	bctar 31,0
+ .endif
diff --git a/gas/testsuite/gas/ppc/bcat.d b/gas/testsuite/gas/ppc/bcat.d
new file mode 100644
index 0000000000..56d55ec5e8
--- /dev/null
+++ b/gas/testsuite/gas/ppc/bcat.d
@@ -0,0 +1,68 @@ 
+#source: bc.s
+#as: -mpower8 --defsym POWER8=1 --defsym AT=1
+#objdump: -d -Mpower8
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0+ <\.text>:
+   0:	(40 00 00 00|00 00 00 40) 	bdnzf   lt,0 .*
+   4:	(40 40 00 00|00 00 40 40) 	bdzf    lt,4 .*
+   8:	(40 80 00 00|00 00 80 40) 	bge     8 .*
+   c:	(40 c0 00 00|00 00 c0 40) 	bge-    c .*
+  10:	(40 e0 00 00|00 00 e0 40) 	bge\+    10 .*
+  14:	(41 00 00 00|00 00 00 41) 	bdnzt   lt,14 .*
+  18:	(41 40 00 00|00 00 40 41) 	bdzt    lt,18 .*
+  1c:	(41 80 00 00|00 00 80 41) 	blt     1c .*
+  20:	(41 c0 00 00|00 00 c0 41) 	blt-    20 .*
+  24:	(41 e0 00 00|00 00 e0 41) 	blt\+    24 .*
+  28:	(42 00 00 00|00 00 00 42) 	bdnz    28 .*
+  2c:	(42 40 00 00|00 00 40 42) 	bdz     2c .*
+  30:	(42 80 00 00|00 00 80 42) 	bc      20,lt,30 .*
+  34:	(43 00 00 00|00 00 00 43) 	bdnz-   34 .*
+  38:	(43 20 00 00|00 00 20 43) 	bdnz\+   38 .*
+  3c:	(43 40 00 00|00 00 40 43) 	bdz-    3c .*
+  40:	(43 60 00 00|00 00 60 43) 	bdz\+    40 .*
+  44:	(4c 80 04 20|20 04 80 4c) 	bgectr
+  48:	(4c c0 04 20|20 04 c0 4c) 	bgectr-
+  4c:	(4c e0 04 20|20 04 e0 4c) 	bgectr\+
+  50:	(4d 80 04 20|20 04 80 4d) 	bltctr
+  54:	(4d c0 04 20|20 04 c0 4d) 	bltctr-
+  58:	(4d e0 04 20|20 04 e0 4d) 	bltctr\+
+  5c:	(4e 80 04 20|20 04 80 4e) 	bctr
+  60:	(4c 00 00 20|20 00 00 4c) 	bdnzflr lt
+  64:	(4c 40 00 20|20 00 40 4c) 	bdzflr  lt
+  68:	(4c 80 00 20|20 00 80 4c) 	bgelr
+  6c:	(4c c0 00 20|20 00 c0 4c) 	bgelr-
+  70:	(4c e0 00 20|20 00 e0 4c) 	bgelr\+
+  74:	(4d 00 00 20|20 00 00 4d) 	bdnztlr lt
+  78:	(4d 40 00 20|20 00 40 4d) 	bdztlr  lt
+  7c:	(4d 80 00 20|20 00 80 4d) 	bltlr
+  80:	(4d c0 00 20|20 00 c0 4d) 	bltlr-
+  84:	(4d e0 00 20|20 00 e0 4d) 	bltlr\+
+  88:	(4e 00 00 20|20 00 00 4e) 	bdnzlr
+  8c:	(4e 40 00 20|20 00 40 4e) 	bdzlr
+  90:	(4e 80 00 20|20 00 80 4e) 	blr
+  94:	(4f 00 00 20|20 00 00 4f) 	bdnzlr-
+  98:	(4f 20 00 20|20 00 20 4f) 	bdnzlr\+
+  9c:	(4f 40 00 20|20 00 40 4f) 	bdzlr-
+  a0:	(4f 60 00 20|20 00 60 4f) 	bdzlr\+
+  a4:	(4c 00 04 60|60 04 00 4c) 	bdnzftar lt
+  a8:	(4c 40 04 60|60 04 40 4c) 	bdzftar lt
+  ac:	(4c 80 04 60|60 04 80 4c) 	bgetar
+  b0:	(4c c0 04 60|60 04 c0 4c) 	bgetar-
+  b4:	(4c e0 04 60|60 04 e0 4c) 	bgetar\+
+  b8:	(4d 00 04 60|60 04 00 4d) 	bdnzttar lt
+  bc:	(4d 40 04 60|60 04 40 4d) 	bdzttar lt
+  c0:	(4d 80 04 60|60 04 80 4d) 	blttar
+  c4:	(4d c0 04 60|60 04 c0 4d) 	blttar-
+  c8:	(4d e0 04 60|60 04 e0 4d) 	blttar\+
+  cc:	(4e 00 04 60|60 04 00 4e) 	bdnztar
+  d0:	(4e 40 04 60|60 04 40 4e) 	bdztar
+  d4:	(4e 80 04 60|60 04 80 4e) 	btar
+  d8:	(4f 00 04 60|60 04 00 4f) 	bdnztar-
+  dc:	(4f 20 04 60|60 04 20 4f) 	bdnztar\+
+  e0:	(4f 40 04 60|60 04 40 4f) 	bdztar-
+  e4:	(4f 60 04 60|60 04 60 4f) 	bdztar\+
+#pass
diff --git a/gas/testsuite/gas/ppc/bcaterr.d b/gas/testsuite/gas/ppc/bcaterr.d
new file mode 100644
index 0000000000..b7bde0b5bf
--- /dev/null
+++ b/gas/testsuite/gas/ppc/bcaterr.d
@@ -0,0 +1,3 @@ 
+#source: bc.s
+#as: -mpower8 --defsym POWER8=1
+#error_output: bcaterr.l
diff --git a/gas/testsuite/gas/ppc/bcaterr.l b/gas/testsuite/gas/ppc/bcaterr.l
new file mode 100644
index 0000000000..9986c8c7ca
--- /dev/null
+++ b/gas/testsuite/gas/ppc/bcaterr.l
@@ -0,0 +1,71 @@ 
+.*: Assembler messages:
+.*:23: Error: .*
+.*:25: Error: .*
+.*:27: Error: .*
+.*:31: Error: .*
+.*:33: Error: .*
+.*:35: Error: .*
+.*:39: Error: .*
+.*:41: Error: .*
+.*:43: Error: .*
+.*:44: Error: .*
+.*:45: Error: .*
+.*:50: Error: .*
+.*:51: Error: .*
+.*:52: Error: .*
+.*:53: Error: .*
+.*:55: Error: .*
+.*:56: Error: .*
+.*:57: Error: .*
+.*:58: Error: .*
+.*:60: Error: .*
+.*:63: Error: .*
+.*:64: Error: .*
+.*:65: Error: .*
+.*:66: Error: .*
+.*:68: Error: .*
+.*:71: Error: .*
+.*:72: Error: .*
+.*:73: Error: .*
+.*:74: Error: .*
+.*:76: Error: .*
+.*:77: Error: .*
+.*:78: Error: .*
+.*:79: Error: .*
+.*:80: Error: .*
+.*:81: Error: .*
+.*:82: Error: .*
+.*:83: Error: .*
+.*:84: Error: .*
+.*:85: Error: .*
+.*:86: Error: .*
+.*:89: Error: .*
+.*:91: Error: .*
+.*:93: Error: .*
+.*:97: Error: .*
+.*:99: Error: .*
+.*:101: Error: .*
+.*:105: Error: .*
+.*:107: Error: .*
+.*:109: Error: .*
+.*:110: Error: .*
+.*:111: Error: .*
+.*:116: Error: .*
+.*:117: Error: .*
+.*:118: Error: .*
+.*:119: Error: .*
+.*:123: Error: .*
+.*:125: Error: .*
+.*:127: Error: .*
+.*:131: Error: .*
+.*:133: Error: .*
+.*:135: Error: .*
+.*:139: Error: .*
+.*:141: Error: .*
+.*:143: Error: .*
+.*:144: Error: .*
+.*:145: Error: .*
+.*:150: Error: .*
+.*:151: Error: .*
+.*:152: Error: .*
+.*:153: Error: .*
diff --git a/gas/testsuite/gas/ppc/bcy.d b/gas/testsuite/gas/ppc/bcy.d
new file mode 100644
index 0000000000..d0efd64cdd
--- /dev/null
+++ b/gas/testsuite/gas/ppc/bcy.d
@@ -0,0 +1,49 @@ 
+#source: bc.s
+#as: -mppc --defsym Y=1
+#objdump: -d -Mppc
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0+ <\.text>:
+   0:	(40 00 00 00|00 00 00 40) 	bdnzf-  lt,0 .*
+   4:	(40 20 00 00|00 00 20 40) 	bdnzf\+  lt,4 .*
+   8:	(40 40 00 00|00 00 40 40) 	bdzf-   lt,8 .*
+   c:	(40 60 00 00|00 00 60 40) 	bdzf\+   lt,c .*
+  10:	(40 80 00 00|00 00 80 40) 	bge-    10 .*
+  14:	(40 a0 00 00|00 00 a0 40) 	bge\+    14 .*
+  18:	(41 00 00 00|00 00 00 41) 	bdnzt-  lt,18 .*
+  1c:	(41 20 00 00|00 00 20 41) 	bdnzt\+  lt,1c .*
+  20:	(41 40 00 00|00 00 40 41) 	bdzt-   lt,20 .*
+  24:	(41 60 00 00|00 00 60 41) 	bdzt\+   lt,24 .*
+  28:	(41 80 00 00|00 00 80 41) 	blt-    28 .*
+  2c:	(41 a0 00 00|00 00 a0 41) 	blt\+    2c .*
+  30:	(42 00 00 00|00 00 00 42) 	bdnz-   30 .*
+  34:	(42 20 00 00|00 00 20 42) 	bdnz\+   34 .*
+  38:	(42 40 00 00|00 00 40 42) 	bdz-    38 .*
+  3c:	(42 60 00 00|00 00 60 42) 	bdz\+    3c .*
+  40:	(42 80 00 00|00 00 80 42) 	bc      20,lt,40 .*
+  44:	(4c 80 04 20|20 04 80 4c) 	bgectr-
+  48:	(4c a0 04 20|20 04 a0 4c) 	bgectr\+
+  4c:	(4d 80 04 20|20 04 80 4d) 	bltctr-
+  50:	(4d a0 04 20|20 04 a0 4d) 	bltctr\+
+  54:	(4e 80 04 20|20 04 80 4e) 	bctr
+  58:	(4c 00 00 20|20 00 00 4c) 	bdnzflr- lt
+  5c:	(4c 20 00 20|20 00 20 4c) 	bdnzflr\+ lt
+  60:	(4c 40 00 20|20 00 40 4c) 	bdzflr- lt
+  64:	(4c 60 00 20|20 00 60 4c) 	bdzflr\+ lt
+  68:	(4c 80 00 20|20 00 80 4c) 	bgelr-
+  6c:	(4c a0 00 20|20 00 a0 4c) 	bgelr\+
+  70:	(4d 00 00 20|20 00 00 4d) 	bdnztlr- lt
+  74:	(4d 20 00 20|20 00 20 4d) 	bdnztlr\+ lt
+  78:	(4d 40 00 20|20 00 40 4d) 	bdztlr- lt
+  7c:	(4d 60 00 20|20 00 60 4d) 	bdztlr\+ lt
+  80:	(4d 80 00 20|20 00 80 4d) 	bltlr-
+  84:	(4d a0 00 20|20 00 a0 4d) 	bltlr\+
+  88:	(4e 00 00 20|20 00 00 4e) 	bdnzlr-
+  8c:	(4e 20 00 20|20 00 20 4e) 	bdnzlr\+
+  90:	(4e 40 00 20|20 00 40 4e) 	bdzlr-
+  94:	(4e 60 00 20|20 00 60 4e) 	bdzlr\+
+  98:	(4e 80 00 20|20 00 80 4e) 	blr
+#pass
diff --git a/gas/testsuite/gas/ppc/bcyerr.d b/gas/testsuite/gas/ppc/bcyerr.d
new file mode 100644
index 0000000000..bafdec5c61
--- /dev/null
+++ b/gas/testsuite/gas/ppc/bcyerr.d
@@ -0,0 +1,3 @@ 
+#source: bc.s
+#as: -mppc
+#error_output: bcyerr.l
diff --git a/gas/testsuite/gas/ppc/bcyerr.l b/gas/testsuite/gas/ppc/bcyerr.l
new file mode 100644
index 0000000000..099f76bca8
--- /dev/null
+++ b/gas/testsuite/gas/ppc/bcyerr.l
@@ -0,0 +1,58 @@ 
+.*: Assembler messages:
+.*:28: Error: .*
+.*:29: Error: .*
+.*:36: Error: .*
+.*:37: Error: .*
+.*:43: Error: .*
+.*:44: Error: .*
+.*:45: Error: .*
+.*:46: Error: .*
+.*:47: Error: .*
+.*:48: Error: .*
+.*:49: Error: .*
+.*:50: Error: .*
+.*:51: Error: .*
+.*:52: Error: .*
+.*:53: Error: .*
+.*:55: Error: .*
+.*:56: Error: .*
+.*:57: Error: .*
+.*:58: Error: .*
+.*:61: Error: .*
+.*:62: Error: .*
+.*:63: Error: .*
+.*:64: Error: .*
+.*:65: Error: .*
+.*:66: Error: .*
+.*:69: Error: .*
+.*:70: Error: .*
+.*:71: Error: .*
+.*:72: Error: .*
+.*:73: Error: .*
+.*:74: Error: .*
+.*:76: Error: .*
+.*:77: Error: .*
+.*:78: Error: .*
+.*:79: Error: .*
+.*:80: Error: .*
+.*:81: Error: .*
+.*:82: Error: .*
+.*:83: Error: .*
+.*:84: Error: .*
+.*:85: Error: .*
+.*:86: Error: .*
+.*:94: Error: .*
+.*:95: Error: .*
+.*:102: Error: .*
+.*:103: Error: .*
+.*:109: Error: .*
+.*:110: Error: .*
+.*:111: Error: .*
+.*:112: Error: .*
+.*:113: Error: .*
+.*:114: Error: .*
+.*:115: Error: .*
+.*:116: Error: .*
+.*:117: Error: .*
+.*:118: Error: .*
+.*:119: Error: .*
diff --git a/gas/testsuite/gas/ppc/ppc.exp b/gas/testsuite/gas/ppc/ppc.exp
index f82dbf196e..62d67a391c 100644
--- a/gas/testsuite/gas/ppc/ppc.exp
+++ b/gas/testsuite/gas/ppc/ppc.exp
@@ -22,6 +22,10 @@  if { ![istarget "powerpc*-*-*"] && ![istarget "rs6000-*-*"] } then {
     return
 }
 
+run_dump_test "bcyerr"
+run_dump_test "bcy"
+run_dump_test "bcaterr"
+run_dump_test "bcat"
 run_dump_test "regnames"
 run_dump_test "misalign"
 run_dump_test "misalign2"