207
}
208
}
209
210
+/*
211
+ * Return true if a VFP insn is OK to access the registers indicated
212
+ * by regmask, false if it should UNDEF. This checks whether the
213
+ * D16-D31 regs are implemented by the CPU. Eventually we will also check
214
+ * CPACR.D32DIS.
215
+ * Note that Neon insns accessing D16..D31 do not need to check D32DIS,
216
+ * so this function is for VFP insns only.
217
+ *
218
+ * @regmask should be the logical OR of the VFP Dregs being accessed.
219
+ */
220
+static bool vfp_dregs_ok(DisasContext *s, int dregmask)
221
+{
222
+ int invalid_dreg_mask = dc_isar_feature(aa32_simd_r32, s) ? 0 : 0x10;
223
+
224
+ return !(dregmask & invalid_dreg_mask);
225
+}
226
+
227
/*
228
* Check that VFP access is enabled, A-profile specific version.
229
*
364
}
365
366
/* UNDEF accesses to D16-D31 if they don't exist */
350
- if (sz == 3 && !dc_isar_feature(aa32_simd_r32, s) &&
351
- ((a->vm | a->vn | a->vd) & 0x10)) {
367
+ if (sz == 3 && !vfp_dregs_ok(s, a->vm | a->vn | a->vd)) {
368
return false;
369
}
370
489
}
490
491
/* UNDEF accesses to D16-D31 if they don't exist */
476
- if (sz == 3 && !dc_isar_feature(aa32_simd_r32, s) &&
477
- ((a->vm | a->vd) & 0x10)) {
492
+ if (sz == 3 && !vfp_dregs_ok(s, a->vm | a->vd)) {
493
return false;
494
}
495
556
}
557
558
/* UNDEF accesses to D16-D31 if they don't exist */
544
- if (sz == 3 && !dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
559
+ if (sz == 3 && !vfp_dregs_ok(s, a->vm)) {
560
return false;
561
}
562
677
}
678
679
/* UNDEF accesses to D16-D31 if they don't exist */
665
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) {
680
+ if (!vfp_dregs_ok(s, a->vn & 0x10)) {
681
return false;
682
}
683
724
}
725
726
/* UNDEF accesses to D16-D31 if they don't exist */
712
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) {
727
+ if (!vfp_dregs_ok(s, a->vn & 0x10)) {
728
return false;
729
}
730
760
}
761
762
/* UNDEF accesses to D16-D31 if they don't exist */
748
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) {
763
+ if (!vfp_dregs_ok(s, a->vn)) {
764
return false;
765
}
766
1045
}
1046
1047
/* UNDEF accesses to D16-D31 if they don't exist */
1033
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
1048
+ if (!vfp_dregs_ok(s, a->vm)) {
1049
return false;
1050
}
1051
1147
}
1148
1149
/* UNDEF accesses to D16-D31 if they don't exist */
1135
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
1150
+ if (!vfp_dregs_ok(s, a->vd)) {
1151
return false;
1152
}
1153
1276
}
1277
1278
/* UNDEF accesses to D16-D31 if they don't exist */
1264
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd + n) > 16) {
1279
+ if (!vfp_dregs_ok(s, a->vd + n - 1)) {
1280
return false;
1281
}
1282
1528
}
1529
1530
/* UNDEF accesses to D16-D31 if they don't exist */
1516
- if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vn | vm) & 0x10)) {
1531
+ if (!vfp_dregs_ok(s, vd | vn | vm)) {
1532
return false;
1533
}
1534
1700
/* Note that the caller must check the aa32_fpdp_v2 feature. */
1701
1702
/* UNDEF accesses to D16-D31 if they don't exist */
1688
- if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vm) & 0x10)) {
1703
+ if (!vfp_dregs_ok(s, vd | vm)) {
1704
return false;
1705
}
1706
2267
}
2268
2269
/* UNDEF accesses to D16-D31 if they don't exist. */
2255
- if (!dc_isar_feature(aa32_simd_r32, s) &&
2256
- ((a->vd | a->vn | a->vm) & 0x10)) {
2270
+ if (!vfp_dregs_ok(s, a->vd | a->vn | a->vm)) {
2271
return false;
2272
}
2273
2394
}
2395
2396
/* UNDEF accesses to D16-D31 if they don't exist. */
2383
- if (!dc_isar_feature(aa32_simd_r32, s) && (vd & 0x10)) {
2397
+ if (!vfp_dregs_ok(s, vd)) {
2398
return false;
2399
}
2400
2569
}
2570
2571
/* UNDEF accesses to D16-D31 if they don't exist. */
2558
- if (!dc_isar_feature(aa32_simd_r32, s) && ((a->vd | a->vm) & 0x10)) {
2572
+ if (!vfp_dregs_ok(s, a->vd | a->vm)) {
2573
return false;
2574
}
2575
2635
}
2636
2637
/* UNDEF accesses to D16-D31 if they don't exist. */
2624
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
2638
+ if (!vfp_dregs_ok(s, a->vd)) {
2639
return false;
2640
}
2641
2716
}
2717
2718
/* UNDEF accesses to D16-D31 if they don't exist. */
2705
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
2719
+ if (!vfp_dregs_ok(s, a->vm)) {
2720
return false;
2721
}
2722
2791
}
2792
2793
/* UNDEF accesses to D16-D31 if they don't exist. */
2780
- if (!dc_isar_feature(aa32_simd_r32, s) && ((a->vd | a->vm) & 0x10)) {
2794
+ if (!vfp_dregs_ok(s, a->vd | a->vm)) {
2795
return false;
2796
}
2797
2870
}
2871
2872
/* UNDEF accesses to D16-D31 if they don't exist. */
2859
- if (!dc_isar_feature(aa32_simd_r32, s) && ((a->vd | a->vm) & 0x10)) {
2873
+ if (!vfp_dregs_ok(s, a->vd | a->vm)) {
2874
return false;
2875
}
2876
2944
}
2945
2946
/* UNDEF accesses to D16-D31 if they don't exist. */
2933
- if (!dc_isar_feature(aa32_simd_r32, s) && ((a->vd | a->vm) & 0x10)) {
2947
+ if (!vfp_dregs_ok(s, a->vd | a->vm)) {
2948
return false;
2949
}
2950
2970
}
2971
2972
/* UNDEF accesses to D16-D31 if they don't exist. */
2959
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
2973
+ if (!vfp_dregs_ok(s, a->vd)) {
2974
return false;
2975
}
2976
2996
}
2997
2998
/* UNDEF accesses to D16-D31 if they don't exist. */
2985
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
2999
+ if (!vfp_dregs_ok(s, a->vm)) {
3000
return false;
3001
}
3002
3077
}
3078
3079
/* UNDEF accesses to D16-D31 if they don't exist. */
3066
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
3080
+ if (!vfp_dregs_ok(s, a->vd)) {
3081
return false;
3082
}
3083
3114
}
3115
3116
/* UNDEF accesses to D16-D31 if they don't exist. */
3103
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
3117
+ if (!vfp_dregs_ok(s, a->vm)) {
3118
return false;
3119
}
3120
3254
}
3255
3256
/* UNDEF accesses to D16-D31 if they don't exist. */
3243
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
3257
+ if (!vfp_dregs_ok(s, a->vd)) {
3258
return false;
3259
}
3260
3383
}
3384
3385
/* UNDEF accesses to D16-D31 if they don't exist. */
3372
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
3386
+ if (!vfp_dregs_ok(s, a->vm)) {
3387
return false;
3388
}
3389