I've found several datasheets for the 74ls181 with pinout and function diagrams as pictured below.
This from Jameco (where I bought mine): https://www.jameco.com/Jameco/Products/ProdDS/46973.pdf
This one as the first google search result: http://www.esi.uclm.es/www/isanchez/apuntes/ci/74181.pdf
These do not at all agree with each other. What happens to P and G when switching modes? What happens to the outputs when switching modes? Do they invert or not? How does one go about sorting out this mess?