arch-x86: Use popCount from bitfields.hh.
authorGabe Black <gabe.black@gmail.com>
Sat, 13 Feb 2021 01:25:24 +0000 (17:25 -0800)
committerGabe Black <gabe.black@gmail.com>
Sat, 13 Feb 2021 08:46:05 +0000 (08:46 +0000)
Use popCount from bitfields.hh rather than call __builtin_popcountl
directly. That will ensure the instruction works whether or not that
builtin is available.

Change-Id: I947b35bb832b768936b489a58ee324adb8a90b5e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41354
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/x86/isa/microops/regop.isa

index 570c0847f2446de9978002a7866ac0552a115a81..63a16831cf5bdf02c838258072bfe9be157a4999 100644 (file)
@@ -1766,10 +1766,7 @@ let {{
         '''
 
     class Popcnt(RegOp):
-        code = '''
-            DestReg =
-                merge(DestReg, __builtin_popcountl(psrc1), dataSize);
-        '''
+        code = 'DestReg = merge(DestReg, popCount(psrc1), dataSize);'
         flag_code = '''
             ccFlagBits = ccFlagBits & ~(SFBit | AFBit | ZFBit | PFBit);
             if (findZero(dataSize * 8, SrcReg1)) {