| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 
 | # Hitachi H8 testcase 'bfld', 'bfst'
# mach(): h8sx
# as(h8300):	--defsym sim_cpu=0
# as(h8300h):	--defsym sim_cpu=1
# as(h8300s):	--defsym sim_cpu=2
# as(h8sx):	--defsym sim_cpu=3
# ld(h8300h):	-m h8300helf
# ld(h8300s):	-m h8300self
# ld(h8sx):	-m h8300sxelf
	.include "testutils.inc"
	.data
byte_src:	.byte	0xa5
byte_dst:	.byte	0
	start
.if (sim_cpu == h8sx)
bfld_imm8_ind:
	set_grs_a5a5
	mov	#byte_src, er2
	;; bfld #xx:8, @ers, rd8
	set_ccr_zero
	bfld	#1, @er2, r1l
	test_cc_clear
	test_h_gr8 1 r1l
	set_ccr_zero
	bfld	#2, @er2, r1l
	test_cc_clear
	test_h_gr8 0 r1l
	set_ccr_zero
	bfld	#7, @er2, r1l
	test_cc_clear
	test_h_gr8 5 r1l
	set_ccr_zero
	bfld	#0x10, @er2, r1l
	test_cc_clear
	test_h_gr8 0 r1l
	set_ccr_zero
	bfld	#0x20, @er2, r1l
	test_cc_clear
	test_h_gr8 1 r1l
	set_ccr_zero
	bfld	#0xf0, @er2, r1l
	test_cc_clear
	test_h_gr8 0xa r1l
	test_h_gr32 0xa5a5a5a5 er0
	test_h_gr32 0xa5a5a50a er1
	test_h_gr32 byte_src   er2
	test_h_gr32 0xa5a5a5a5 er3
	test_h_gr32 0xa5a5a5a5 er4
	test_h_gr32 0xa5a5a5a5 er5
	test_h_gr32 0xa5a5a5a5 er6
	test_h_gr32 0xa5a5a5a5 er7
bfld_imm8_abs16:
	set_grs_a5a5
	;; bfld #xx:8, @aa:16, rd8
	set_ccr_zero
	bfld	#0x80, @byte_src:16, r1l
	test_cc_clear
	test_h_gr8 1 r1l
	set_ccr_zero
	bfld	#0x40, @byte_src:16, r1l
	test_cc_clear
	test_h_gr8 0 r1l
	set_ccr_zero
	bfld	#0xe0, @byte_src:16, r1l
	test_cc_clear
	test_h_gr8 0x5 r1l
	set_ccr_zero
	bfld	#0x3c, @byte_src:16, r1l
	test_cc_clear
	test_h_gr8 9 r1l
	set_ccr_zero
	bfld	#0xfe, @byte_src:16, r1l
	test_cc_clear
	test_h_gr8 0x52 r1l
	set_ccr_zero
	bfld	#0, @byte_src:16, r1l
	test_cc_clear
	test_h_gr8 0 r1l
	test_h_gr32 0xa5a5a5a5 er0
	test_h_gr32 0xa5a5a500 er1
	test_h_gr32 0xa5a5a5a5 er2
	test_h_gr32 0xa5a5a5a5 er3
	test_h_gr32 0xa5a5a5a5 er4
	test_h_gr32 0xa5a5a5a5 er5
	test_h_gr32 0xa5a5a5a5 er6
	test_h_gr32 0xa5a5a5a5 er7
bfst_imm8_ind:
	set_grs_a5a5
	mov	#byte_dst, er2
	;; bfst rd8, #xx:8, @ers
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #1, @er2
;;; 	.word	0x7d20
;;; 	.word	0xf901
	test_cc_clear
	cmp.b	#1, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #2, @er2
;;; 	.word	0x7d20
;;; 	.word	0xf902
	test_cc_clear
	cmp.b	#2, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #7, @er2
;;; 	.word	0x7d20
;;; 	.word	0xf907
	test_cc_clear
	cmp.b	#5, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0x10, @er2
;;; 	.word	0x7d20
;;; 	.word	0xf910
	test_cc_clear
	cmp.b	#0x10, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0x20, @er2
;;; 	.word	0x7d20
;;; 	.word	0xf920
	test_cc_clear
	cmp.b	#0x20, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0xf0, @er2
;;; 	.word	0x7d20
;;; 	.word	0xf9f0
	test_cc_clear
	cmp.b	#0x50, @byte_dst
	bne	fail1:16
	test_h_gr32 0xa5a5a5a5 er0
	test_h_gr32 0xa5a5a5a5 er1
	test_h_gr32 byte_dst   er2
	test_h_gr32 0xa5a5a5a5 er3
	test_h_gr32 0xa5a5a5a5 er4
	test_h_gr32 0xa5a5a5a5 er5
	test_h_gr32 0xa5a5a5a5 er6
	test_h_gr32 0xa5a5a5a5 er7
bfst_imm8_abs32:
	set_grs_a5a5
	;; bfst #xx:8, @aa:32, rd8
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0x80, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf980
	test_cc_clear
	cmp.b	#0x80, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0x40, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf940
	test_cc_clear
	cmp.b	#0x40, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0xe0, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf9e0
	test_cc_clear
	cmp.b	#0xa0, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0x3c, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf93c
	test_cc_clear
	cmp.b	#0x14, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0xfe, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf9fe
	test_cc_clear
	cmp.b	#0x4a, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf900
	test_cc_clear
	cmp.b	#0x0, @byte_dst
	bne	fail1:16
	mov.b	#0, @byte_dst
	set_ccr_zero
	bfst	r1l, #0x38, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf938
	test_cc_clear
	cmp.b	#0x28, @byte_dst
	bne	fail1:16
	;;
	;; Now let's do one in which the bits in the destination
	;; are appropriately combined with the bits in the source.
	;;
	mov.b	#0xc3, @byte_dst
	set_ccr_zero
	bfst	r1l, #0x3c, @byte_dst:32
;;; 	.word	0x6a38
;;; 	.long	byte_dst
;;; 	.word	0xf93c
	test_cc_clear
	cmp.b	#0xd7, @byte_dst
	bne	fail1:16
	test_grs_a5a5
.endif
	pass
	exit 0
fail1:	fail
	
 |