Riot police blasted about 500 rebel convicts with a five-hour barrage of smoke grenades and rubber bullets today, then burst into cellblocks at Madrid's Carabanchel prison and crushed the prisoners' four-day rooftop mutiny.

Police said about 20 inmates were injured, some of them by self-inflicted knife wounds. No deaths were reported.

The revolt, demanding amnesty and better conditions, spread to 15 other prisons around Spain.

The Carabanchel inmates took to the prison roofs Monday, saying they would not give up until Premier Adolfo Suarez or a top aide came to hear their demands. The prisoners, serving long terms for non-political crimes, were not included in an amnesty granted to 6,000 last summer.

Led by a new organization called Prisoners' Coordinated Struggle, the inmates charged that prison conditions had not improved since the death of rightist dictator Gen. Francisco Franco in November 1975.

No government officials came to Carabanchel, and with food and water running out in 90-degree heat, the prisoners asked police for safe passage off the roofs today after the officers moved in and took three of seven cellblocks held by the inmates.

But a militant group of convicts stoned police trying to put a ladder against a wall.

The police opened their bombardment at midday after negotiations broke down, and the inmates ignored a surrender ultimatum. Prisoners shouted "Police assassins," retaliated with bricks and stones and threw some of the smoke grenades off the roofs.

Mounted police chased away reporters, photographers and prisoners' relatives at gunpoint. Some reporters said police fired live rounds. Police denied it.