diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2015-09-01 16:44:29 +0200 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2015-09-01 16:44:29 +0200 |
commit | 75d50c12ee220fecf955b1626c78b78636cbca92 (patch) | |
tree | d1d3926a9df12113d36350ed6c8d6f55e373c748 /powerpc/Asmexpand.ml | |
parent | 951963b380f1ff1e0b55f8303e4ae098cedb3cb5 (diff) | |
download | compcert-kvx-75d50c12ee220fecf955b1626c78b78636cbca92.tar.gz compcert-kvx-75d50c12ee220fecf955b1626c78b78636cbca92.zip |
Added the gcc builtin prefetch.
This commit implements the gcc __builtin_prefetch in a form with all
arguments for the powerpc architecture. The resulting instructions are
the dcbt and dcbtst instructions in Server Category.
Diffstat (limited to 'powerpc/Asmexpand.ml')
-rw-r--r-- | powerpc/Asmexpand.ml | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index 5216214b..57765c50 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -428,6 +428,17 @@ let expand_builtin_inline name args res = emit (Pdcbi (GPR0,a1)) | "__builtin_icbi", [BA(IR a1)],_ -> emit (Picbi(GPR0,a1)) + | "__builtin_prefetch" , [BA (IR addr);BA_int rw; BA_int loc],_ -> + if not ((loc >= _0) && (loc < _4)) then + raise (Error "the last argument of __builtin_prefetch must be a constant between 0 and 3"); + if Int.eq rw _0 then begin + emit (Pdcbt (loc,addr)); + end else if Int.eq rw _1 then begin + emit (Pdcbtst (loc,addr)); + end else + raise (Error "the second argument of __builtin_prefetch must be either 0 or 1") + | "__builtin_prefetch" ,_,_ -> + raise (Error "the second and third argument of __builtin_prefetch must be a constant") (* Special registers *) | "__builtin_get_spr", [BA_int n], BR(IR res) -> emit (Pmfspr(res, n)) |