Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b651406

Browse files
committed
ENH: Implement a compile-time test on PPC64 to determine support for Half/Double VSX3 instructions by the assembler
1 parent 8d0bdd4 commit b651406

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

meson_cpu/ppc64/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ VSX3 = mod_features.new(
2626
'VSX3', 3, implies: VSX2, args: {'val': '-mcpu=power9', 'match': '.*[mcpu=|vsx].*'},
2727
detect: {'val': 'VSX3', 'match': 'VSX.*'},
2828
test_code: files(source_root + '/numpy/distutils/checks/cpu_vsx3.c')[0],
29+
extra_tests: {
30+
'VSX3_HALF_DOUBLE': files(source_root + '/numpy/distutils/checks/extra_vsx3_half_double.c')[0]
31+
}
2932
)
3033
VSX4 = mod_features.new(
3134
'VSX4', 4, implies: VSX3, args: {'val': '-mcpu=power10', 'match': '.*[mcpu=|vsx].*'},

numpy/distutils/ccompiler_opt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ class _Config:
301301
## Power8/ISA 2.07
302302
VSX2 = dict(interest=2, implies="VSX", implies_detect=False),
303303
## Power9/ISA 3.00
304-
VSX3 = dict(interest=3, implies="VSX2", implies_detect=False),
304+
VSX3 = dict(interest=3, implies="VSX2", implies_detect=False,
305+
extra_checks="VSX3_HALF_DOUBLE"),
305306
## Power10/ISA 3.1
306307
VSX4 = dict(interest=4, implies="VSX3", implies_detect=False,
307308
extra_checks="VSX4_MMA"),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Assembler may not fully support the following VSX3 scalar
3+
* instructions, even though compilers report VSX3 support.
4+
*/
5+
int main(void)
6+
{
7+
unsigned short bits = 0xFF;
8+
double f;
9+
__asm__ __volatile__("xscvhpdp %x0,%x1" : "=wa"(f) : "wa"(bits));
10+
__asm__ __volatile__ ("xscvdphp %x0,%x1" : "=wa" (bits) : "wa" (f));
11+
return bits;
12+
}

0 commit comments

Comments
 (0)