Apple M1 Microarchitecture Research by Dougall Johnson

Firestorm: Overview | Base Instructions | SIMD and FP Instructions
Icestorm:  Overview | Base Instructions | SIMD and FP Instructions

SHRN2 (4S)

Test 1: uops

Code:

  shrn2 v0.8h, v1.4s, #3
  movi v0.16b, 1
  movi v1.16b, 2

(no loop instructions)

1000 unrolls and 1 iteration

Retires: 1.000

Issues: 1.000

Integer unit issues: 0.000

Load/store unit issues: 0.000

SIMD/FP unit issues: 1.000

retire (01)cycle (02)03191e3f4e51inst issue (52)~issue fp/simd (54)~dispatch fp/simd (57)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op fp/simd (7e)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst neon or fp (9a)a8accfd5d6ddinst fetch restart (de)e0? fp/simd (ee)f5f6f7f8fd
1004303722006125482510001000100039831303018303730372415328951000100020003037303711100110000073116112630100030383038303830383038
10043037230156125482510001000100039831303018303730372415328951000100020003037303711100110000073116112630100030383038303830383038
1004303723006125482510001000100039831303018303730852415328951000100020003037303711100110000073116112630100030383038303830383038
10043037220128225482510001000100039831303018303730372415328951000100020003037303711100110000073116112630100030383038308530383038
1004303723036125482510001000100039831303018303730372415328951000100020003037303711100110000073116112630100030383038303830383038
10043037220126125482510001000100039831303018303730372415328951000100020003037303711100110001073116112630100030383038303830383038
1004303723006125482510001000100039831303018303730372415328951000100020003037303711100110001073116112630100030383038303830383038
1004303722006125482510001000100039831303018303730372415328951000100020003037303711100110001073116112630100030383038303830383038
1004303722006125482510001000100039831303018303730372415328951000100020003037303711100110000073116112630100030383038303830383038
100430372201218925482510001000100039831303018303730372415328951000100020003037303711100110000073116112630100030383038303830383038

Test 2: Latency 1->1

Code:

  shrn2 v0.8h, v1.4s, #3
  movi v0.16b, 1
  movi v1.16b, 2

(fused SUBS/B.cc loop)

100 unrolls and 100 iterations

Result (median cycles for code): 3.0037

retire (01)cycle (02)030818191e1f3f4e51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa0a1a6a8a9acc2c5cfd5d6ddinst fetch restart (de)e0? int output thing (e9)? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
102043003722500012061295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038
102043003722500000985295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000002071011611296340100001003003830038300383003830038
10204300372250000061295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038
10204300372250000061295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038
10204300372240000061295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038
102043003722500000173295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038
10204300372250000061295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038
102043003722500000612954825101001001000010010000679427731303001830037300372826532874510100200100002002000030037300371110201100991001001000010000000240071011611296340100001003003830038300383003830038
10204300372250000061295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038
102043003722500000251295482510100100100001001000050042773130300183003730037282653287451010020010000200200003003730037111020110099100100100001000000000071011611296340100001003003830038300383003830038

1000 unrolls and 10 iterations

Result (median cycles for code): 3.0037

retire (01)cycle (02)031e1f3f4e51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9faccfd5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
10024300372241806129548251001010100001010000504277313030018300373003728287328767100102010000222033230037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038
1002430037225006129548251001010100001010000504277313030018300373003728287328767100102010000202000030037300371110021109101010000100640216222963010000103003830038300383003830038

Test 3: Latency 1->2

Code:

  shrn2 v0.8h, v0.4s, #3
  movi v0.16b, 1

(fused SUBS/B.cc loop)

100 unrolls and 100 iterations

Result (median cycles for code): 3.0037

retire (01)cycle (02)030818191e1f3a3f4e51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa8acc5branch mispredict (cb)cdcfd5d6ddinst fetch restart (de)e0? int output thing (e9)? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
102043003722400000061295472510100100100001001000050042771600300183003730037282716287401010020010008200200163003730037111020110099100100100001000011172222422296290100001003003830038300383003830038
102043003722500000097295472510100100100001001000050042771601300183003730037282526287331010020010000200200003003730037111020110099100100100001000011172222422296290100001003003830038300383003830038
102043003722500000097295472510100100100001001000050042771601300183003730037282526287331010020010000200200003003730037111020110099100100100001000011172222422296290100001003003830038300383003830038
102043003722500000097295472510100100100001001000050042771600300183003730037282526287331010020010000200200003003730037111020110099100100100001000011172222422296290100001003003830038300383003830038
102043003722500000197295472510100100100001001000050042771601300183003730037282526287331025520010000200200003003730037111020110099100100100001000011172222422296290100001003003830038300383003830038
102043003722500000197295472510100100100001001000050042771600300183003730037282526287331010020010000200200003003730037111020110099100100100001000311172222422296290100001003003830038300383003830038
102043003722400000197295472510100100100001001000050042771601300183003730037282526287331010020010000200200003003730037111020110099100100100001000011172222422296290100001003003830038300383003830038
102043003722500000061295472510100100100001001000050042771600300183003730037282716287401010020010008200200163003730037111020110099100100100001000011171701600296460100001003003830038300383003830038
102043003722500000061295472510100100100001001000050042771600300183003730037282716287411010020010008200200163003730037111020110099100100100001000011171701600296450100001003003830038300383003830038
102043003722500000061295472510100100100001001000050042771601300183003730037282717287411010020010008200200163003730037111020110099100100100001000011171801600296460100001003003830038300383003830038

1000 unrolls and 10 iterations

Result (median cycles for code): 3.0037

retire (01)cycle (02)0308090b1e3f4e51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa1a8a9acc5cfd5d6ddinst fetch restart (de)e0? int output thing (e9)eb? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
100243003722500006129547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038
100243003722500006129547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290410000103003830038300383003830038
1002430037224000025329547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038
100243003722500006129547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100003064021622296290010000103003830038300383003830038
100243003722500006129547251001010100001010000504277160130018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038
100243003722500006129547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038
100243003722500006129547251001010100001010000504277160130018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038
1002430037225000015629547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038
100243003722500006129547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038
100243003722400006129547251001010100001010000504277160030018300373003728286328767100102010000202000030037300371110021109101010000100000064021622296290010000103003830038300383003830038

Test 4: throughput

Count: 8

Code:

  movi v0.16b, 0
  shrn2 v0.8h, v8.4s, #3
  movi v1.16b, 0
  shrn2 v1.8h, v8.4s, #3
  movi v2.16b, 0
  shrn2 v2.8h, v8.4s, #3
  movi v3.16b, 0
  shrn2 v3.8h, v8.4s, #3
  movi v4.16b, 0
  shrn2 v4.8h, v8.4s, #3
  movi v5.16b, 0
  shrn2 v5.8h, v8.4s, #3
  movi v6.16b, 0
  shrn2 v6.8h, v8.4s, #3
  movi v7.16b, 0
  shrn2 v7.8h, v8.4s, #3
  movi v8.16b, 9

(fused SUBS/B.cc loop)

100 unrolls and 100 iterations

Result (median cycles for code divided by count): 0.2508

retire (01)cycle (02)03181e1f3f51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)696d6escheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa0a1a6a8a9acc2c5branch mispredict (cb)cdcfd6e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
16020420088150000712580116100800161008002850064019620045200652006561280128200800282001600562006520065111602011009910010016000010000010001111011916200621600001002006620066200662006620066
16020420065150000292580116100800161008002850064019620045200652006561280128200800282001600562006520065111602011009910010016000010000000001111011916200621600001002006620066200662006620066
160204200651500002925801161008001610080028500640196200452006520065610180128200800282001600562006520065111602011009910010016000010000010001111011916200621600001002006620066200662017120066
16020420065150000292580116100800161008002850064019620045200652006561280128200800282001600562006520065111602011009910010016000010022010001111011916200621600001002006620066200662006620066
16020420065151000292580116100800161008002850064019620045200652006561280128200800282001600562006520065111602011009910010016000010000000001111011916200621600001002006620066200662006620066
16020420065151000292580116100800161008002850064187620045200652006561280128200800282001600562006520065111602011009910010016000010000000001111011916200621600001002006620066200662006620066
160204200651510120292580116100800161008002850064019620045200652006561280128200803432001600562006520065111602011009910010016000010000010001111011916200621600001002006620066200662006620066
16020420065150000292580116100800161008002850064019620045200652006561280128200800282001600562006520065111602011009910010016000010000000001111011916200621600001002006620066200662006620066
16020420065150000292580116100800161008002850064019620045200652006561280128200800282001600562006520065111602011009910010016000010000000001111011916200621600001002006620066200662006620066
16020420065150000292580116100800161008002850064019620045200652006561280128200800282001600562006520065111602011009910010016000010000000001111011916200621600001002006620066200662006620066

1000 unrolls and 10 iterations

Result (median cycles for code divided by count): 0.2506

retire (01)cycle (02)03181e3f51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)5f6061696d6escheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa8acc2cfd0d2icache miss (d3)d5d6d9dadbddinst fetch restart (de)e0eaebec? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
160024200911501051278001010800001080000506400000102003220051200513228001020800002016000020060200601116002110910101600001000210031831734421892005720363160000102006120061200612006120061
16002420060150104527800101080000108000050640000015201052006020060322800102080000201600002006020060111600211091010160000100001003111621025422992005740362160000102006120061200612006120061
1600242005115000512980010108000010800005064000001520032200602006032280010208000020160000200602006011160021109101016000010000100311162934222992005740352160000102006120052200612006120061
160024200601500051298001010800001080000506400000152004120060200603228001020800002016000020060200601116002110910101600001000010036116210344221082005740222160000102006120061200612006120061
160024200601500051298001010800001080000506400000152004120060200603228001020800002016000020060200601116002110910101600001021901003611628344228102005740102160000102006120061200612006320061
16002420060150005129800101080000108000050640000015200412006020060322800102080000201600002006020060111600211091010160000100001003711629344221172005740162160000102006120061200612006120061
1600242006015000512980010108000010800005064000001520041200602006032280010208000020160000200602005111160021109101016000010000100371162634422792005740102160000102006120061200612006120061
16002420060151005129800101080000108000050640000015200412006020060322800102080000201600002006020060111600211091010160000100001003311627344221072005740182160000102006120061200612006120061
1600242006015000512980010108000010800005064000001520041200602006032280010208000020160000200602006011160021109101016000010700100331162934422792005740122160000102006120061200612006120061
160024200601500051298001010800001080000506400000152003220060200603228001020800002016000020060200601116002110910101600001000010034116210344221072005720102160000102006120061200612006120052

Test 5: throughput

Count: 16

Code:

  shrn2 v0.8h, v16.4s, #3
  shrn2 v1.8h, v16.4s, #3
  shrn2 v2.8h, v16.4s, #3
  shrn2 v3.8h, v16.4s, #3
  shrn2 v4.8h, v16.4s, #3
  shrn2 v5.8h, v16.4s, #3
  shrn2 v6.8h, v16.4s, #3
  shrn2 v7.8h, v16.4s, #3
  shrn2 v8.8h, v16.4s, #3
  shrn2 v9.8h, v16.4s, #3
  shrn2 v10.8h, v16.4s, #3
  shrn2 v11.8h, v16.4s, #3
  shrn2 v12.8h, v16.4s, #3
  shrn2 v13.8h, v16.4s, #3
  shrn2 v14.8h, v16.4s, #3
  shrn2 v15.8h, v16.4s, #3
  movi v16.16b, 17

(fused SUBS/B.cc loop)

100 unrolls and 100 iterations

Result (median cycles for code divided by count): 0.2502

retire (01)cycle (02)031e3f51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9facc5branch mispredict (cb)cdcfd5d6ddinst fetch restart (de)e0eaeb? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
1602044005830001467251601081001600081001600205001280132140020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101182163440036001600001004004040040400404004040040
16020440039300051251601081001600081001600205001280132140020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101183164340036001600001004004040040400404004040040
16020440039300030251601081001600081001600205001280132140020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101183164340036001600001004004040040400404004040040
16020440039300030251601081001600081001600205001280132140020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101184162440036061600001004004040040400404004040040
16020440039300030251601081001600081001600205001280132040020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101184164440036001600001004004040040400404004040040
16020440039300030251601081101600081001600205001280132040020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101183163340036001600001004004040040400404004040040
16020440039300030251601081001600081001600205001280132040020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101183163340036001600001004004040040400404004040040
16020440039300022025160108100160008100160020500128013204002040039400391997761999016012020016003220032006440039400391116020110099100100160000100132111101183163440036001600001004004040040400404004040040
16020440039300030251601081001600081001600205001280132040020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101184164340036001600001004004040040400404004040040
160204400392990281251601081001600081001600205001280132040020400394003919977619990160120200160032200320064400394003911160201100991001001600001000111101183163440036001600001004004040040400404004040040

1000 unrolls and 10 iterations

Result (median cycles for code divided by count): 0.2502

retire (01)cycle (02)0307080a18191e1f3f51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)5f6061696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa0a1a8acc2cfd0d2icache miss (d3)d5d6d9dadbddinst fetch restart (de)e0eaeb? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
16002440050299000000030525160010101600001016000050128000010040020400394003919996320019160010201600002032000040039400391116002110910101600001000000100223115164113440036406160000104004040040400404004040040
160024400393000000000455251600101016000010160000501280000110400204003940039199963200191600102016000020320000400394003911160021109101016000010000001002232141621144400364012160000104004040040400404004040040
160024400393000000000717251600101116000010160000501280000105400204003940039199963200191600102016000020320000400394003911160021109101016000010000001002231141621143400364013160000104024940558405624050540502
160024405593030111081455792186421016098310160883101606215012882281054042840510405542007044202841609652016095220322098403494055712116002110910101600001022128450102013113644214440437206160000104061140555402974060640555
160024405763042101151461880197720616098310160917111611575012841561104046540606406072008847203111610532016105820322116405024061381160021109101016000010000001002282141621144400364012160000104004040040400404004040040
16002440039300001000049125160010101600001016010650128000000540020400394003919996320019160010201600002032000040039400391116002110910101600001000000100223114162114340036206160000104004040040400404004040040
1600244003930000000003442516001010160000101600005012800001004002040039400391999632001916001020160000203200004003940039111600211091010160000100000010022113131621134400364012160000104004040040400404004040040
16002440039300000000051225160010101600001016000050128000010040020400394003919996320019160010201600002032000040039400391116002110910101600001000000100228114164113440036206160000104004040040400404004040040
1600244003930000000004682516001010160000101600005012800001104002040039400391999632001916001020160000203200004003940039111600211091010160000100000010022113141622144400364012160000104004040040400404004040040
1600244003929900000005225160010101600001016000050128245611540020400394003919996320019160010201600002032000040039400391116002110910101600001000004100228214162113440036206160000104004040040400404004040040