tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

03_add_neon64_and_sve_gyp_targets.patch (5918B)


      1 diff --git a/libyuv.gyp b/libyuv.gyp
      2 index 45df0d2e26192..e2aa2d7c69404 100644
      3 --- a/libyuv.gyp
      4 +++ b/libyuv.gyp
      5 @@ -71,9 +71,7 @@
      6             # '-mthumb',  # arm32 not thumb
      7           ],
      8           'cflags_mozilla!': [
      9 -            '-mfpu=vfp',
     10 -            '-mfpu=vfpv3',
     11 -            '-mfpu=vfpv3-d16',
     12 +            '<@(moz_neon_cflags_block_list)',
     13           ],
     14           'conditions': [
     15             # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug.
     16 @@ -108,16 +106,6 @@
     17                 '-ffat-lto-objects',
     18               ],
     19             }],
     20 -            # arm64 does not need -mfpu=neon option as neon is not optional
     21 -            ['target_arch != "arm64"', {
     22 -              'cflags': [
     23 -                '-mfpu=neon',
     24 -                # '-marm',  # arm32 not thumb
     25 -              ],
     26 -              'cflags_mozilla': [
     27 -                '-mfpu=neon',
     28 -              ],
     29 -            }],
     30           ],
     31         }],
     32         ['build_msa != 0', {
     33 @@ -157,6 +145,11 @@
     34             }],
     35           ],
     36         }],
     37 +        ['target_arch == "arm64" and moz_have_arm_sve2 != 1 and build_with_mozilla == 1', {
     38 +          'defines' :[
     39 +            'LIBYUV_DISABLE_SVE',
     40 +          ]
     41 +        }],
     42       ], #conditions
     43       'defines': [
     44         # Enable the following 3 macros to turn off assembly for specified CPU.
     45 @@ -186,12 +179,94 @@
     46               '-Wl,--dynamic-linker,/system/bin/linker',
     47             ],
     48           }],
     49 +          ['target_arch == "armv7" or target_arch == "arm64" and moz_have_arm_i8mm_and_dot_prod == 1 and build_with_mozilla == 1', {
     50 +            'dependencies': [
     51 +                 ':libyuv_neon',
     52 +            ],
     53 +          }],
     54 +          ['target_arch == "arm64" and moz_have_arm_sve2 == 1 and build_with_mozilla == 1', {
     55 +            'dependencies': [
     56 +                 ':libyuv_sve',
     57 +            ],
     58 +          }],
     59         ], #conditions
     60       },
     61       'sources': [
     62         '<@(libyuv_sources)',
     63       ],
     64     },
     65 +    {
     66 +      'target_name': 'libyuv_neon',
     67 +      'type': 'static_library',
     68 +      'variables': {
     69 +        'optimize': 'max',  # enable O2 and ltcg.
     70 +      },
     71 +      'conditions': [
     72 +        ['target_arch == "arm64" and moz_have_arm_i8mm_and_dot_prod == 1 and build_with_mozilla == 1', {
     73 +          'cflags_mozilla': [
     74 +            '-march=armv8.2-a+dotprod+i8mm',
     75 +          ],
     76 +        }],
     77 +        # arm64 does not need -mfpu=neon option as neon is not optional
     78 +        ['target_arch != "arm64"', {
     79 +          'cflags': [
     80 +            '-mfpu=neon',
     81 +            # '-marm',  # arm32 not thumb
     82 +          ],
     83 +          'cflags_mozilla': [
     84 +            '-mfpu=neon',
     85 +          ],
     86 +        }],
     87 +        ['build_neon != 0', {
     88 +          'cflags_mozilla!': [
     89 +            '<@(moz_neon_cflags_block_list)',
     90 +          ],
     91 +          'sources': [
     92 +            '<@(libyuv_neon_sources)',
     93 +          ],
     94 +        }],
     95 +     ], #conditions
     96 +      'include_dirs': [
     97 +        'include',
     98 +        '.',
     99 +      ],
    100 +      'direct_dependent_settings': {
    101 +        'include_dirs': [
    102 +          'include',
    103 +          '.',
    104 +        ], #conditions
    105 +      },
    106 +    },
    107 +    {
    108 +      'target_name': 'libyuv_sve',
    109 +      'type': 'static_library',
    110 +      'variables': {
    111 +        'optimize': 'max',  # enable O2 and ltcg.
    112 +      },
    113 +      'conditions': [
    114 +        ['target_arch == "arm64" and moz_have_arm_sve2 == 1 and build_with_mozilla == 1', {
    115 +          'cflags_mozilla!': [
    116 +            '<@(moz_neon_cflags_block_list)',
    117 +          ],
    118 +          'cflags_mozilla': [
    119 +            '-march=armv9-a+dotprod+sve2+i8mm',
    120 +          ],
    121 +          'sources': [
    122 +            '<@(libyuv_sve_sources)',
    123 +          ],
    124 +        }],
    125 +     ], #conditions
    126 +      'include_dirs': [
    127 +        'include',
    128 +        '.',
    129 +      ],
    130 +      'direct_dependent_settings': {
    131 +        'include_dirs': [
    132 +          'include',
    133 +          '.',
    134 +        ], #conditions
    135 +      },
    136 +    },
    137   ], # targets.
    138 }
    139 
    140 diff --git a/libyuv.gypi b/libyuv.gypi
    141 index 74fa0fe63b57b..1fd1be71e3414 100644
    142 --- a/libyuv.gypi
    143 +++ b/libyuv.gypi
    144 @@ -8,6 +8,29 @@
    145 
    146 {
    147   'variables': {
    148 +    'moz_have_arm_sve2%': '<(moz_have_arm_sve2)',
    149 +    'moz_have_arm_i8mm_and_dot_prod%': '<(moz_have_arm_i8mm_and_dot_prod)',
    150 +    'moz_neon_cflags_block_list': [
    151 +            '-mfpu=vfp',
    152 +            '-mfpu=vfpv3',
    153 +            '-mfpu=vfpv3-d16',
    154 +    ],
    155 +    # Needs to be reflected in upstream gyp file.
    156 +    'libyuv_sve_sources': [
    157 +      # sources.
    158 +      'source/row_sve.cc',
    159 +    ],
    160 +    'libyuv_neon_sources': [
    161 +      # ARM Source Files
    162 +      "source/compare_neon.cc",
    163 +      "source/compare_neon64.cc",
    164 +      "source/rotate_neon.cc",
    165 +      "source/rotate_neon64.cc",
    166 +      "source/row_neon.cc",
    167 +      "source/row_neon64.cc",
    168 +      "source/scale_neon.cc",
    169 +      "source/scale_neon64.cc",
    170 +    ],
    171     'libyuv_sources': [
    172       # includes.
    173       'include/libyuv.h',
    174 @@ -41,8 +64,6 @@
    175       'source/compare_common.cc',
    176       'source/compare_gcc.cc',
    177       'source/compare_msa.cc',
    178 -      'source/compare_neon.cc',
    179 -      'source/compare_neon64.cc',
    180       'source/compare_win.cc',
    181       'source/convert.cc',
    182       'source/convert_argb.cc',
    183 @@ -62,8 +83,6 @@
    184       'source/rotate_gcc.cc',
    185       'source/rotate_lsx.cc',
    186       'source/rotate_msa.cc',
    187 -      'source/rotate_neon.cc',
    188 -      'source/rotate_neon64.cc',
    189       'source/rotate_win.cc',
    190       'source/row_any.cc',
    191       'source/row_common.cc',
    192 @@ -71,8 +90,6 @@
    193       'source/row_msa.cc',
    194       'source/row_lasx.cc',
    195       'source/row_lsx.cc',
    196 -      'source/row_neon.cc',
    197 -      'source/row_neon64.cc',
    198       'source/row_win.cc',
    199       'source/scale.cc',
    200       'source/scale_any.cc',
    201 @@ -81,8 +98,6 @@
    202       'source/scale_gcc.cc',
    203       'source/scale_lsx.cc',
    204       'source/scale_msa.cc',
    205 -      'source/scale_neon.cc',
    206 -      'source/scale_neon64.cc',
    207       'source/scale_rgb.cc',
    208       'source/scale_uv.cc',
    209       'source/scale_win.cc',